跳过内容

开始使用

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. 安装包

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

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

需求

需求项
  • Capacitor 8+
  • Android与Intune Android 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' });
  • acquireToken(options): 开始 Microsoft 登录并返回令牌及帐户元数据。
  • acquireTokenSilent(options): 读取已存在帐户的缓存令牌。
  • registerAndEnrollAccount(options): 使用 Intune 注册 MSAL 帐户并触发注册。
  • loginAndEnrollAccount(): 让 Intune 驱动登录和注册流程。
  • appConfig(user): 读取 Intune 应用程序配置值。
  • getPolicy(user): 读取 Intune 应用程序保护策略。
  • groupName(user): 读取公共配置助手值(当存在时)。 GroupName : 检查打包的 Intune 和 MSAL 版本。
  • sdkVersion()平台说明

protectedTokens

平台说明
  • Web不受支持。
  • iOS和Android都需要本机项目配置 cap sync.
  • 您的Azure注册、Intune策略分配、重定向URI和权限仍然是应用程序特有的。

继续从Getting Started

继续从Getting Started

如果您正在使用 Getting Started 来规划迁移和企业运营,连接它与 使用@capgo/capacitor-intune 为native能力在使用@capgo/capacitor-intune Capgo企业 为Capgo企业版产品工作流程 Ionic 企业插件替代品 为Ionic 企业插件替代品产品工作流程 Capgo替代品 为Capgo替代品产品工作流程,和 Capgo咨询 为Capgo咨询产品工作流程