Zum Inhalt springen

Erste Schritte

GitHub

Du kannst unser KI-gestütztes Setup nutzen, um das Plugin zu installieren. Füge die Capgo Skills mit dem folgenden Befehl deinem KI-Tool hinzu:

Terminalfenster
bunx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

Nutze dann diesen Prompt:

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-intune` plugin in my project.

Wenn du ein manuelles Setup bevorzugst, installiere das Plugin mit den folgenden Befehlen und befolge die plattformspezifischen Anweisungen unten:

  1. Paket installieren

    Terminalfenster
    bun add @capgo/capacitor-intune
  2. Native Projekte synchronisieren

    Terminalfenster
    bunx cap sync
  3. Native Intune-Setup abschließen Folge den speziellen iOS-Setup und Android-Setup Seiten. Intune erfordert weiterhin native Host-App-Konfigurationen für brokered auth, Redirect URIs, Manifests, Entitlements und MSAL-Config.

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' });
  • Listener: Handles beim Unmounten von Screens entfernen.
  • Nativer Sync: ausführen bunx cap sync nach Plugin-Upgrades.
  • Single Source of Truth: Vertrauen src/definitions.ts im GitHub Repo.
  • Capacitor 8+
  • Android mit Intune Android SDK 12.0.3
  • iOS mit Intune iOS SDK 21.5.1
  • iOS Deployment Target 17.0+

In der Intune-Dokumentation von Ionic wird derzeit ein Stichtag am 19. Januar 2026 für mit Xcode 26 erstellte Apps genannt, was Intune iOS SDK erfordert 21.1.0+. Dieses Plugin nutzt bereits 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-Login starten und Token sowie Kontometadaten zurückgeben.
  • acquireTokenSilent(options): Ein zwischengespeichertes Token für ein bestehendes Konto auslesen.
  • registerAndEnrollAccount(options): Das MSAL-Konto bei Intune registrieren und die Registrierung auslösen.
  • loginAndEnrollAccount(): Den Login- und Registrierungsflow über Intune steuern.
  • appConfig(user): Intune-App-Konfigurationswerte für das Konto auslesen.
  • getPolicy(user): Die aktuelle Intune App Protection Policy für das Konto auslesen.
  • groupName(user): Den gemeinsamen GroupName Config-Helper-Wert auslesen, falls vorhanden.
  • sdkVersion(): Die mitgelieferten Intune- und MSAL-Versionen prüfen.
  • Web wird nicht unterstützt.
  • Sowohl iOS als auch Android erfordern zusätzlich eine native Projektkonfiguration cap sync.
  • Deine Azure-Registrierung, Intune-Policy-Zuweisung, Redirect-URIs und Entitlements bleiben app-spezifisch.

Wenn du es nutzt Erste Schritte um Migration und Enterprise-Betrieb zu planen, verbinde es mit Verwendung von @capgo/capacitor-intune für die native Funktion bei der Verwendung von @capgo/capacitor-intune, Capgo Enterprise für den Produkt-Workflow in Capgo Enterprise, Ionic Enterprise Plugin-Alternativen für den Produkt-Workflow in Ionic Enterprise Plugin-Alternativen, Capgo Alternativen für den Produkt-Workflow in Capgo Alternativen, und Capgo Consulting für den Produkt-Workflow in Capgo Consulting.