跳过内容

Intune 应用程序仓库

GitHub

您可以使用我们的AI辅助设置来安装插件。添加以下命令中的Capgo技能到您的AI工具中:

终端窗口
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

然后使用以下提示:

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-intune` plugin in my project.

如果您更喜欢手动设置,请运行以下命令并按照以下平台特定的说明进行安装:

  1. 安装包

    终端窗口
    bun add @capgo/capacitor-intune
  2. 同步本机项目

    终端窗口
    bunx cap sync
  3. 完成本机 Intune 设置 遵循专门的 iOS 设置 和 安卓设置 页面。 Intune 还需要主机应用本机配置来支持授权代理、重定向 URI、清单、特权和 MSAL 配置。

  • Capacitor 8+
  • 安卓与 Intune 安卓 SDK 12.0.3
  • iOS 与 Intune iOS SDK 21.5.1
  • iOS 部署目标 17.0+

Ionic的Intune文档目前要求截止于2026年1月19日,要求使用Xcode 26构建的应用程序,需要Intune iOS SDK 21.1.0+. 这个插件已经使用 21.5.1.

import { IntuneMAM } from '@capgo/capacitor-intune';
await IntuneMAM.addListener('appConfigChange', (result) => {
console.log('App config changed', result.accountId);
});
await IntuneMAM.addListener('policyChange', (result) => {
console.log('Policy changed', result.accountId);
});
const auth = await IntuneMAM.acquireToken({
scopes: ['https://graph.microsoft.com/.default'],
loginHint: 'alex@example.com',
});
await IntuneMAM.registerAndEnrollAccount({
accountId: auth.accountId,
});
const appConfig = await IntuneMAM.appConfig({
accountId: auth.accountId,
});
const policy = await IntuneMAM.getPolicy({
accountId: auth.accountId,
});
console.log({ auth, appConfig, policy });

交互式登录和注册

标题:交互式登录和注册
const auth = await IntuneMAM.acquireToken({
scopes: ['https://graph.microsoft.com/.default'],
});
await IntuneMAM.registerAndEnrollAccount({
accountId: auth.accountId,
});

静默令牌刷新

标题:静默令牌刷新
const token = await IntuneMAM.acquireTokenSilent({
accountId: 'AAD_OBJECT_ID',
scopes: ['https://graph.microsoft.com/.default'],
forceRefresh: true,
});

查看当前已注册账户

查看已注册账户
const user = await IntuneMAM.enrolledAccount();

注销或选择性擦除

注销或擦除
await IntuneMAM.logoutOfAccount({ accountId: 'AAD_OBJECT_ID' });
await IntuneMAM.deRegisterAndUnenrollAccount({ accountId: 'AAD_OBJECT_ID' });

API 总结

API 总结
  • acquireToken(options): 开始 Microsoft 登录并返回令牌及账户元数据
  • acquireTokenSilent(options): 读取缓存令牌
  • registerAndEnrollAccount(options): 注册 MSAL 账户并触发注册
  • loginAndEnrollAccount(): 让 Intune 驱动登录和注册流程。
  • appConfig(user): 读取 Intune 应用程序配置值。
  • getPolicy(user): 读取当前 Intune 应用程序保护策略。
  • groupName(user): 读取通用 GroupName : 读取 config 助手值(当存在时)。
  • sdkVersion(): 检查打包的 Intune 和 MSAL 版本。
  • : Web 不受支持。
  • : iOS 和 Android 都需要本机项目配置,超出了 cap sync.
  • : 你的 Azure 注册、Intune 策略分配、重定向 URI 和权限都需要根据应用程序进行配置。

如果您正在使用 开始使用 连接它以规划迁移和企业运营 使用@capgo/capacitor-Intune for the native capability in Using @capgo/capacitor-intune Capgo 企业 为企业产品工作流程在Capgo中 for the product workflow in __CAPGO_KEEP_0__ 企业 Ionic 企业插件替代品 Capgo 替代方案 Capgo 替代品 Capgo 咨询 为产品工作流程在 Capgo 咨询中