コンテンツにスキップ

はじめに

  1. パッケージをインストール

    ターミナルウィンドウ
    bun add @capgo/capacitor-intune
  2. ネイティブプロジェクトを同期

    ターミナルウィンドウ
    bunx cap sync
  3. ネイティブIntune設定を完了 専用の iOS設定Android設定 pages. Intune はホストアプリのネイティブ設定が必要です。ブローカーアUTH、リダイレクトURI、manifest、エンタイトルメント、およびMSAL設定。

  • Capacitor 8+
  • Android with Intune Android SDK 12.0.3
  • iOS with 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.

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): MSAL アカウントを Intune と連携してエンロールをトリガーします。
  • loginAndEnrollAccount(): Intune がサインインとエンロール フローを制御します。
  • appConfig(user): アカウントの Intune アプリ設定値を読み取ります。
  • getPolicy(user): アカウントの Intune アプリ保護ポリシーを読み取ります。
  • groupName(user): 共通の GroupName config ヘルパー値が存在する場合に読み取ります。
  • sdkVersion(): __CAPGO_KEEP_0__をインスパクトしたIntuneとMSALのバージョン。

プラットフォームに関する注意

「プラットフォームに関する注意」セクション
  • Webはサポートされていません。
  • iOSとAndroidは両方とも、nativeプロジェクトの構成が必要です。 cap sync.
  • あなたのAzureの登録、Intuneのポリシー割り当て、リダイレクトURI、およびエンタイトメントはアプリ固有です。