メインコンテンツへスキップ

スタートガイド

GitHub

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.

手動セットアップを希望する場合は、以下のコマンドを実行してプラグインをインストールし、下記のプラットフォーム別の手順に従ってください:

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

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

    ターミナル
    bunx cap sync
  3. Intuneのネイティブ設定を完了する 専用の iOSの設定 と Androidの設定 ページに従ってください。ブローカー認証、リダイレクトURI、マニフェスト、Entitlements、およびMSALの設定には、引き続きホストアプリ側のネイティブ構成が必要です。

import { IntuneMAM } from '@capgo/capacitor-intune';
const result = await IntuneMAM.acquireToken({ scopes: ['openid'] });
// The result holds sensitive values: use it without logging it.
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.
import { IntuneMAM } from '@capgo/capacitor-intune';
await IntuneMAM.registerAndEnrollAccount({ accountId: 'account-id-123' });
  • リスナー: 画面がアンマウントされたらハンドルを削除します。
  • ネイティブ同期: 実行 bunx cap sync プラグインのアップグレード後。
  • 信頼できる情報源: 信頼 src/definitions.ts GitHub リポジトリ内。
  • 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.

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,
});

サイレントなトークンリフレッシュ

「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' });
  • acquireToken(options): Microsoftへのサインインを開始し、トークンとアカウントのメタデータを返します。
  • acquireTokenSilent(options): 既存アカウントのキャッシュされたトークンを読み取ります。
  • registerAndEnrollAccount(options): MSALアカウントをIntuneに登録し、エンロールメントを開始します。
  • loginAndEnrollAccount(): Intuneによるログインおよびエンロールメントフローに従います。
  • appConfig(user): アカウントのIntuneアプリ設定値を読み取ります。
  • getPolicy(user): アカウントに適用されている現在のIntuneアプリ保護ポリシーを読み取ります。
  • groupName(user): 共通の GroupName config helper値が存在する場合に読み取ります。
  • 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 のプロダクトワークフロー向けに。