tomas.kracmar cd0d516951 docs: document tenant comparison, bulk scope tags, full export, wrapper and lazy migration
README: intune wrapper, menu overview, batch/sorted export, tenant comparison
section, bulk scope tags, lazy group/filter creation. AGENTS.md: structure,
menu $menuDefs convention, folder picker, SettingOverrides, FullExportRoot.
2026-11-24 13:12:55 +01:00
2026-04-08 16:09:30 +02:00
2023-10-17 20:34:44 +11:00
2026-11-24 12:27:15 +01:00
2019-06-10 13:44:25 +10:00
2025-09-14 14:15:15 +10:00

macOS Intune Management

Cross-platform, headless Intune policy export/import with PowerShell.

Current version: 4.6.2 — see CHANGELOG_macOS_IntuneToolkit.md for recent changes.

This repository is now CLI-first. The old WPF application surface has been removed from the repo. The supported workflow is:

  1. export policies from a source tenant
  2. store the exported JSON and migration table
  3. import into a target tenant with app-only or browser authentication

Quick start

The easiest way to get started is the unified launcher. It provides a single terminal UI for every tool and remembers your tenants.

pwsh ./Start-IntuneToolkit.ps1

If fzf is installed you get an interactive picker; otherwise you get a numbered menu. You can also pass a tenant directly:

pwsh ./Start-IntuneToolkit.ps1 -TenantId "<tenant-id>"

On macOS/Linux the intune wrapper starts the same launcher without typing pwsh, and runs any script by name:

./intune                                                   # launcher
./intune Export-Policies -TenantId <id> -ExportPath ~/out  # Scripts/Export-Policies.ps1
./intune Compare-Tenants --root-a A --root-b B             # Scripts/Compare-Tenants.py
ln -s "$PWD/intune" ~/.local/bin/intune                    # optional: use it from anywhere

Launcher menu (numbers are assigned automatically in this order): export/import (including Full tenant export into a dated folder with an optional drift check against the previous export), bulk operations (assignments, rename, delete, scope tags, devices), baselines and compliance, reporting (reports, Entra role membership, offline tenant comparison) and tenant/auth administration. Folder prompts use an fzf folder browser with "create new folder".

Entry points

Runtime

  • pwsh 7+
  • Microsoft Graph app registration
  • App-only auth with client secret or certificate, or browser auth with a public client redirect URI
  • fzf (optional) — for the best interactive menu experience in Start-IntuneToolkit.ps1. Falls back to numbered menus if not installed.
    • macOS: brew install fzf
    • Linux: sudo apt install fzf (or dnf / pacman)
    • Windows: winget install junegunn.fzf (or choco install fzf)

Default object types

The default headless policy scope is:

  • DeviceConfiguration
  • SettingsCatalog
  • AdministrativeTemplates
  • CompliancePolicies
  • EndpointSecurity
  • PolicySets
  • ... and about 40 more (scripts, Autopilot, enrollment, app protection, update policies including Quality Updates (Profiles/Policies), role definitions, scope tags, filters, Conditional Access, ...). The full list is Get-DefaultIntunePolicyObjectTypes in Headless/IntuneManagement.Headless.psm1.

You can override that list with -ObjectTypes.

First-time setup

If you don't already have an Entra app registration, run the auth initializer. It creates the app, grants admin consent, and stores the secret in the macOS Keychain (or Windows Credential Manager).

pwsh ./Scripts/Initialize-IntuneAuth.ps1

Export

pwsh ./Scripts/Export-Policies.ps1 `
  -TenantId "<source-tenant-id>" `
  -AppId "<app-id>" `
  -Secret "<client-secret>" `
  -ExportPath "/tmp/intune-export" `
  -IncludeAssignments

Export uses the Graph batch API (20 objects per call) and writes JSON with sorted properties so repeated exports diff cleanly. Pass -NoBatchApi to fall back to one call per object. Role definitions are exported with their role assignments, including built-in roles; on import built-in roles are not created, their assignments are recreated only when assignments are imported.

Export with browser auth

pwsh ./Scripts/Export-Policies.ps1 `
  -TenantId "<source-tenant-id>" `
  -AuthMode Browser `
  -ExportPath "/tmp/intune-export"

Import

pwsh ./Scripts/Import-Policies.ps1 `
  -TenantId "<target-tenant-id>" `
  -AppId "<app-id>" `
  -Secret "<client-secret>" `
  -ImportPath "/tmp/intune-export/SourceTenantName" `
  -ImportType alwaysImport `
  -IncludeAssignments `
  -IncludeScopeTags `
  -ReplaceDependencyIds

Import with browser auth

pwsh ./Scripts/Import-Policies.ps1 `
  -TenantId "<target-tenant-id>" `
  -AuthMode Browser `
  -ImportPath "/tmp/intune-export/SourceTenantName"

Single action entry point

pwsh ./Scripts/Start-HeadlessIntune.ps1 `
  -Action Export `
  -TenantId "<source-tenant-id>" `
  -AppId "<app-id>" `
  -Secret "<client-secret>" `
  -ExportPath "/tmp/intune-export"
pwsh ./Scripts/Start-HeadlessIntune.ps1 `
  -Action Import `
  -TenantId "<target-tenant-id>" `
  -AppId "<app-id>" `
  -Secret "<client-secret>" `
  -ImportPath "/tmp/intune-export/SourceTenantName" `
  -ImportType alwaysImport
pwsh ./Scripts/Start-HeadlessIntune.ps1 `
  -Action Export `
  -TenantId "<source-tenant-id>" `
  -AuthMode Browser `
  -RedirectUri "http://localhost" `
  -ExportPath "/tmp/intune-export"

Additional toolkit scripts

Tenant comparison

Compare-Tenants.py compares two export folders offline (no Graph calls): two tenants with different name prefixes and assignments, or two exports of one tenant to see drift.

./intune Compare-Tenants \
  --root-a ~/Local/IntuneExports/SSD-261124 --label-a SSD --strip-a '^SSD\s*-\s*' \
  --root-b ~/Local/IntuneExports/SSE-261124 --label-b SSE --strip-b '^SSE\s*-\s*' \
  --output-dir ~/Local/IntuneExports/compare [--include-assignments]
  • Works for every exported category (Settings Catalog, device configuration, compliance, Autopilot, ESP, roles, apps, ...). IDs, timestamps, scope tags, OData metadata and names are ignored; GUIDs are resolved to names through the exported groups and filters.
  • Policies are matched by name after stripping the per-tenant prefix (--strip-a/--strip-b, regex), then by fuzzy name similarity (--fuzzy-threshold), then by near-identical content (--content-threshold). --no-fuzzy keeps exact matching only; every non-exact match is listed with its score.
  • Output: tenant-comparison.md (summary per category, only-in-A/B, setting-level differences) and tenant-comparison.csv.
  • Leave both prefixes blank to compare two exports of the same tenant. The Full tenant export menu entry offers this automatically after exporting.

Notes

  • Export writes a migration table used during cross-tenant import.
  • Import can translate dependency IDs. With Import assignments, Entra groups (and, with Replace dependency ids, assignment filters) are looked up or created in the target tenant only when an imported object references them. Synced source groups are created as cloud groups.
  • Win32 app install/uninstall scripts are exported and recreated on import.
  • This repo intentionally does not preserve the old Windows UI launch flow.
  • Browser auth uses the system browser and a loopback redirect.
  • If you omit -AppId with -AuthMode Browser, the CLI defaults to the Microsoft Graph PowerShell public client app id 14d82eec-204b-4c2f-b7e8-296a70dab67e.
  • If your own app registration does not allow loopback redirects, pass -AppId and -RedirectUri "http://localhost" and configure the same redirect URI in Entra ID.

Accountability & PIM caveats

By default Initialize-IntuneAuth.ps1 creates an app-only registration. Every Graph call is authenticated as the service principal, not as an individual user.

  • Audit logs show the app's display name (e.g., IntuneManagement-tomas.kracmar@cqre.net), not the admin's UPN. The initializer now automatically names the app after the authenticated Entra user to improve traceability.
  • PIM is not enforced for app-only secrets. The service principal has standing permissions, so write operations can occur outside an elevated PIM window.
  • If you need strict PIM compliance, use delegated authentication (-AuthMode Browser or -AuthMode DeviceCode) so calls are made in the signed-in user's context. Note that DeviceCode may be blocked by Conditional Access policies.
  • To fully remove a tenant's local credentials and the Entra app registration, use menu item 24 ("Delete tenant auth and app registration") in the TUI or run ./Scripts/Initialize-IntuneAuth.ps1 -TenantId "<id>" -DeleteApp.
S
Description
No description provided
Readme MIT
40 MiB
Languages
PowerShell 87.1%
Python 12.5%
C# 0.3%
Shell 0.1%