开始使用
复制一个包含安装步骤和本插件的完整 Markdown 指南的配置提示。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-intune`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/intune/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
您可以使用我们的 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.如果您更喜欢手动设置,请按照以下命令安装插件并遵循以下平台特定的说明:
-
安装包
Terminal 窗口 bun add @capgo/capacitor-intune -
同步本机项目
Terminal 窗口 bunx cap sync -
完成本机 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 });常见流程
需求项:常见流程[Interactive sign-in and enrollment]
[Section titled “Interactive sign-in and enrollment”]const auth = await IntuneMAM.acquireToken({ scopes: ['https://graph.microsoft.com/.default'],});
await IntuneMAM.registerAndEnrollAccount({ accountId: auth.accountId,});[Silent token refresh]
[Section titled “Silent token refresh”]const token = await IntuneMAM.acquireTokenSilent({ accountId: 'AAD_OBJECT_ID', scopes: ['https://graph.microsoft.com/.default'], forceRefresh: true,});[Read the currently enrolled account]
[Section titled “Read the currently enrolled account”]const user = await IntuneMAM.enrolledAccount();[Sign out or selectively wipe]
[Section titled “Sign out or selectively wipe”]await IntuneMAM.logoutOfAccount({ accountId: 'AAD_OBJECT_ID' });await IntuneMAM.deRegisterAndUnenrollAccount({ accountId: 'AAD_OBJECT_ID' });API Summary
标题:API SummaryacquireToken(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咨询产品工作流程