スタートガイド
インストール手順と、このプラグインの完全な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アシストによるセットアップでプラグインをインストールできます。以下のコマンドを使用して、お使いのAIツールに Capgo のスキルを追加してください:
bunx 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.手動セットアップを希望する場合は、以下のコマンドを実行してプラグインをインストールし、下記のプラットフォーム別の手順に従ってください:
-
パッケージをインストール
ターミナル bun add @capgo/capacitor-intune -
ネイティブプロジェクトを同期
ターミナル bunx cap sync -
ネイティブ Intune セットアップの完了 専用の iOSの設定 と Androidの設定 ページに従ってください。Intune では、ブローカー認証、リダイレクト URI、マニフェスト、エンタイトルメント、MSAL 設定のために、ホストアプリのネイティブ設定が必要です。
クイックスタート
「クイックスタート」セクションimport { IntuneMAM } from '@capgo/capacitor-intune';
const result = await IntuneMAM.acquireToken({ scopes: ['openid'] });// The result holds sensitive values: use it without logging it.例: acquireTokenSilent
セクション「Example: acquireTokenSilent」import { IntuneMAM } from '@capgo/capacitor-intune';
const result = await IntuneMAM.acquireTokenSilent({ scopes: ['openid'], accountId: 'acquireToken',});// The result holds sensitive values: use it without logging it.例: registerAndEnrollAccount
セクション「Example: registerAndEnrollAccount」import { IntuneMAM } from '@capgo/capacitor-intune';
await IntuneMAM.registerAndEnrollAccount({ accountId: 'account-id-123' });よくある落とし穴
「よくある落とし穴」セクション- リスナー: 画面がアンマウントされたらハンドルを削除します。
- ネイティブ同期: 実行
bunx cap syncプラグインのアップグレード後。 - 信頼できる情報源: 信頼
src/definitions.tsGitHub リポジトリ内。
- Capacitor 8以上
- Intune 環境での Android SDK
12.0.3 - Intune 環境での iOS SDK
21.5.1 - iOS デプロイメントターゲット
17.0+
Ionic の Intune ドキュメントでは、Xcode 26 でビルドされたアプリについて 2026 年 1 月 19 日の期限が示されており、Intune iOS の SDK が必要です 21.1.0+。このプラグインはすでに 21.5.1.
基本的な使い方
「Basic Usage」セクション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 });よくあるフロー
「Common Flows」セクション対話型サインインと登録
「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」セクション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 アカウントを Intune に登録し、エンロールメントをトリガーします。loginAndEnrollAccount()Intune がログインと登録フローを制御します。appConfig(user)アカウントの Intune アプリ設定値を読み取ります。getPolicy(user)アカウントの現在の Intune アプリ保護ポリシーを読み取ります。groupName(user): 共通のGroupNameconfig ヘルパー値が存在する場合に読み取ります。sdkVersion()バンドルされた Intune と MSAL のバージョンを確認します。
プラットフォームに関する注意点
「プラットフォームに関する注意事項」セクション- Web はサポートされていません。
- iOS と Android の両方で、ネイティブプロジェクトの設定がさらに必要です。
cap sync. - Azure 登録、Intune ポリシー割り当て、リダイレクト URI、エンタイトルメントはアプリ固有のままです。
Getting Startedの続きを進める
「Getting Started からの続き」セクション使用している場合 スタートガイド 移行とエンタープライズ運用を計画するには、次と連携してください @capgo/capacitor-intuneの使用方法 @capgo/capacitor-intune の使用におけるネイティブ機能について、 Capgo エンタープライズ Capgo Enterprise のプロダクトワークフロー向けに、 Ionic Enterprise プラグインの代替案 Ionic Enterprise Plugin Alternatives のプロダクトワークフロー向けに、 Capgo の代替案 Capgo Alternatives のプロダクトワークフロー向け、および Capgo コンサルティング Capgo Consulting のプロダクトワークフロー向けに。