IntuneManagement Toolkit

repository·master·Indexed 24 days ago

https://github.com/micke-k/intunemanagement

A PowerShell and WPF-based toolkit for managing Microsoft Intune and Azure environments. It enables administrators to export, import, compare, and clone Intune configurations for tenant migrations, backups, and DevOps automation using MSAL, Microsoft Graph APIs, and Azure Management APIs. Key features include dependency support for object relationships, silent batch jobs for CI/CD, ADMX import for 3rd party applications, and registry value management.

Tokens
12.1K
Snippets
4
Records
77
Agent score
84%

What's inside IntuneManagement

  1. Overview of IntuneManagement

    master

    IntuneManagement is a PowerShell-based tool with a WPF UI designed to manage Microsoft Intune and Azure objects using MSAL, Microsoft Graph APIs, and Azure Management APIs. It enables administrators to backup, clone, or migrate complete Intune environments by exporting and importing objects (including assignments and dependencies) between tenants.

    Key capabilities include:

    • Export/Import: Supports full environment cloning, including assignments and group creation (including dynamic groups).
    • Dependency Support: Handles relationships like App Protection depending on an App, or Policy Sets depending on Compliance Policies, by using exported JSON files to map IDs and names.
    • Bulk Operations: Supports bulk export, import, copy, and comparison.
    • Documentation: Can document profiles and policies using the same language strings found in the Intune portal.
  2. Configure Tenant Specific Settings

    master

    Starting with version 3.3.1 (Beta), the tool supports tenant-specific settings. This allows you to define unique configurations for different environments, such as restricting deletions in test environments or using specific Intune app folders per tenant.

    Key behaviors:

    • Login settings like Cloud and GCC are only applied when logging on with a cached token. Otherwise, the tool uses the current tenant settings.
    • Only Setting Values are supported for tenant-specific overrides; some global settings (like the last Bulk Compare strings) remain global.
    • Cached settings might not automatically update when switching to a different tenant.
  3. Understand ADMX Ingestion via Policy CSP

    master

    ADMX ingestion is performed using the Windows Policy CSP. When a Custom Profile with ADMX ingestion is assigned to a device, the Policy CSP adds information to the registry and creates an ADMX file in the local file system.

    OMA-URI Path for Ingestion

    To ingest an ADMX, use the following OMA-URI pattern: ./device/Vendor/MSFT/Policy/ConfigOperations/ADMXInstall/<AppID>/[Policy|Preference]/<ADMXFileName>

    Example: ./device/Vendor/MSFT/Policy/ConfigOperations/ADMXInstall/Chrome/Policy/ChromeAdmx

    File System Location

    The resulting ADMX file (e.g., ChromeAdmx.admx) is stored at: %ProgramData%\Microsoft\PolicyManager\ADMXIngestion\<ProviderGuid>\<AppID>\ (under the [Policy|Preference] subfolder).

    Important: Uniqueness Requirements

    • AppID Uniqueness: The AppID must be unique for different versions of the same ADMX. Because ADMX files share Category IDs, using the same AppID for different versions will cause conflicts. For example, use Chromev91 instead of just Chrome for version-specific deployments.
    • Filename Uniqueness: If the same ADMX filename is used, the first file saved wins; Intune does not appear to overwrite existing ADMX files.
    ./device/Vendor/MSFT/Policy/ConfigOperations/ADMXInstall/Chrome/Policy/ChromeAdmx
  4. Use Permission Detection with Default Permissions

    master

    When Use Default Permissions is enabled (which is the default setting as of version 3.3.1 Beta), the tool checks the required permissions against the Access Token consented to by the selected Azure App.

    How it works:

    • If permissions are missing for specific objects, they are marked in red in the menu.
    • You can hide these items by enabling Hide No-access items in Settings.
    • Note for Consultants: If you access multiple environments (e.g., US Government) where you might not have permission to grant consent, you can enable this globally and then disable it for specific tenants where permissions can be manually added.
  5. Configure documentation separators for CSV and Word

    master

    The documentation engine handles complex properties using separators. By default, multi-property values (like firewall rules) use a comma (,) as a property separator, and properties containing multiple values use a new line as an object separator.

    If you are documenting to a CSV format, you may want to change these separators (e.g., using | as an object separator) to ensure the CSV structure remains intact. These separators can be configured within the documentation settings.

  6. Understand MSAL Token Caching and Security

    master

    The tool uses the Microsoft Authentication Library (MSAL) via Microsoft.Identity.Client.dll to authenticate to Microsoft Graph.

    Token Caching

    • Storage: Tokens are cached in an encrypted file named msalcahce.bin3 located in %LOCALAPPDATA%\CloudAPIPowerShellManagement.
    • Security: The cache file is encrypted and can only be decrypted by the same user who created it. Credentials are never stored, only the tokens.
    • Lifecycle: Tokens expire after 1 hour. MSAL automatically manages token refreshing. If a user's roles change and a refresh is needed, you can trigger a forced refresh via the Profile Info popup.
    • Disabling Cache: You can disable token caching within the tool's Settings.

    Token Types

    The tool manages three types of tokens:

    1. MSAL Token: Created during authentication; contains both Access and ID tokens.
    2. Access token: Used for calling Microsoft Graph APIs; contains permission information.
    3. ID Token: Contains user information used for logging in.

    Note that Access and ID tokens are encoded (not encrypted) JSON Web Tokens (JWT).

  7. Migrate objects between Intune environments

    master

    The tool provides enhanced support for migrating objects between different Intune environments, including:

    • Group Migrations: Support for various group types, including Dynamic Groups.
    • Dependency Management: For objects like Policy Sets that reference other objects (e.g., Compliance Settings), the import process uses exported JSON files to identify dependencies and automatically map old IDs to new IDs in the target environment.
    • Scope Tags: Can be migrated using the dependency functionality (ensure Scope Tags are exported/imported first).
    • Assignments: Improved support for migrating object assignments.
  8. Manage multi-tenant authentication with MSAL

    master

    Since version 3.0.0 Beta 1, authentication is managed via the Microsoft Authentication Library (MSAL). This enables several capabilities:

    • Switching between users.
    • Switching between tenants (Multi-tenant support must be enabled in Settings).
    • Viewing token information and profile pictures.

    Dependencies: This requires Microsoft.Identity.Client.dll, which is included in the Az or MSAL.PS modules. Version 3.0.0 Beta 1 was tested with MSAL version 4.21.0.0.

  9. Replace or Update existing profiles during import

    master
    In version 3.1.7, an experimental/preview feature was added to support replacing or updating existing profiles and policies during the import process. Refer to the Import section in the README.md for specific implementation details and instructions.
  10. Understanding Settings-based vs. Property-based objects

    master

    Intune objects are categorized into two main types for documentation purposes:

    Settings-based Objects

    These include Settings Catalog, Endpoint Security policies, and Administrative Templates.

    • Data Source: Information is retrieved via Microsoft Graph APIs.
    • Content: They only store information about configured settings, not all available settings.
    • Language: Column headers and basic info are pulled from static language files.

    Property-based Objects

    These are more complex and can be documented using a combination of:

    • Generated JSON files
    • Manually created JSON files
    • PowerShell functions
    • A combination of the above

    Note: JSON files for translating property objects are located in the Documentation\ObjectInfo folder. Files starting with # are manually created (based on @OData.Type or Object Type Id). Files without # are automatically generated, with mappings managed in ObjectCategories.json.

  11. Compare exported files with Intune objects

    master

    Version 3.9.7 introduced a new Compare provider: Intune Objects with Exported Files (Name). This allows you to compare policies that have been exported to files against the live objects currently in Intune, facilitating environment-to-environment comparisons.

    Additionally, the comparison engine supports:

    • Skipping missing source policies.
    • Skipping missing destination policies.
    • Ignoring Basic properties and Assignments (note: properties will still be logged but with an empty value for the Match field).
  12. Migrate policies between environments with TenantID translation

    master
    In version 3.7.2, a feature was added to automatically translate TenantID values when importing policies into a new environment. This ensures that any policy containing a specific Tenant ID is correctly updated for the target tenant during the migration process.