Automating Autopilot Profile Creation and Assignments Using PowerShell Graph API for Intune

Introduction

In large enterprises with a global presence, IT administrators often face the challenge of managing Windows Autopilot deployment profiles across different regions. These deployment profiles often have different device naming convention, Language or target Organizational Unit (Hybrid Join Deployements) requiring separate Autopilot profiles with unique configuration settings.

This usually requires a lot of manual work when setting up a new Windows Autopilot profiles and configurations

To solve this problem, I developed a set of PowerShell functions that:
βœ… Create new Autopilot profiles via Graph API
βœ… Assign them to region-specific dynamic groups

By leveraging these functions, IT admins can easily generate multiple Autopilot profiles and assign them to the appropriate groups on the fly. Additionally, this process can be fully automated by reading configurations from a CSV file, enabling mass profile creation with minimal effort.

The Challenge: Managing Autopilot Profiles in a Global Organization

In a global enterprise, different regions may follow unique device naming conventions and deployment settings. For example:

Region Device Naming Convention Deployment Mode Language (Locale) Join Type
North America NA-XXXXX User-driven en-US Hybrid
Germany GR-XXXXX Self-deploying de-DE AzureAD
Japan APAC-XXXXX User-driven ja-JP AzureAD
Brazil LATAM-XXXXX Self-deploying pt-BR AzureAD

Since Autopilot profiles cannot be dynamically assigned to devices based on naming patterns within Intune, IT admins must create multiple deployment profiles and assign them to separate dynamic groups based on device attributes.

Doing this manually is time-consuming and error-proneβ€”this is where automation comes in.

Automating Autopilot Profiles with PowerShell Graph API

Manually configuring Autopilot deployment profiles via Microsoft Intune can be time-consuming, especially when managing multiple profiles for different device types (Windows, HoloLens, etc.), deployment modes (Hybrid, Azure AD Join, Self-deploying, etc.), and language settings.

To automate this process, I created the New-AutopilotDeploymentProfile function, which allows admins to define all necessary parameters within PowerShell.

Creating an Autopilot Profile Using PowerShell

The New-AutopilotDeploymentProfile function enables the creation of customized Autopilot deployment profiles by specifying parameters such as:

  • Display name β†’ Profile name for identification
  • Deployment mode β†’ User-driven, self-deploying
  • Join type β†’ Hybrid Azure AD Join or Azure AD Join
  • Language locale β†’ Default language setting or a specific Locale
  • Device type β†’ Windows PC or HoloLens

Example 1: Create a Hybrid Joined Deployment Profile for Windows PC

πŸ’‘ What This Does:

  • Creates a Hybrid Azure AD joined Autopilot deployment profile for Windows PCs
  • Configures the language locale as English (US)
  • Enables pre-provisioning (formerly known as white-glove) for faster deployment

Example 2: Create an Azure AD Joined Deployment Profile for HoloLens

πŸ’‘ What This Does:

  • Creates a Self-Deploying Autopilot profile for HoloLens devices
  • Ensures devices automatically join Azure AD
  • Uses a device naming convention (HOLO%SERIAL%) to match organizational standards
  • Keeps the license terms and privacy settings visible in the Out-of-Box Experience (OOBE)

Example 3: Create an Azure AD Joined Deployment Profile for Windows PCs

πŸ’‘ What This Does:

  • Creates a User-driven Autopilot profile for Windows PCs
  • Configures devices to join Azure AD
  • Sets the default language locale to Swiss German (de-CH)
  • Pre-provisioning is enabled to allow IT teams to pre-configure devices before user assignment

Assigning Autopilot Profiles to Dynamic Groups

Once an Autopilot deployment profile is created, it must be assigned to a device group to ensure the correct devices receive the right profile.

To automate this process, I created the Set-AutopilotDeploymentProfileAssignment function, which allows admins to:
βœ… Assign an Autopilot profile to multiple groups
βœ… Exclude specific groups from receiving the profile
βœ… Automate assignments across regions and deployment types

Example: Assigning an Autopilot Profile to Multiple Groups

πŸ’‘ What This Does:

  • Assigns the Autopilot profile “MyProfile” to Group1 and Group2
  • Excludes Group3 from receiving this profile

This approach ensures that only the correct regional or department-based groups get the right deployment profile.

Scaling Automation: Creating Multiple Profiles from a CSV

For organizations that manage multiple Autopilot profiles, manually running these commands for each profile is inefficient. Instead, you can read all profile configurations from a CSV file and automate bulk creation.

CSV Example: Profiles.csv

DisplayName DeploymentMode JoinToEntraIDAs LanguageLocale ProfileType ApplyDeviceNameTemplate AllowPreprovisionedDeployment IncludedGroups ExcludedGroups
North America Profile UserDriven azureAD en-US windowsPc NA-%SERIAL% TRUE Autopilot-NA None
Europe Profile SelfDeploying azureAD en-GB windowsPc EU-%SERIAL% FALSE Autopilot-EU TestGroup
APAC Profile UserDriven Hybrid en-US windowsPc APAC-%SERIAL% TRUE Autopilot-APAC None

PowerShell Script to Automate Everything

πŸ’‘ What This Does:

  • Reads all profile settings from a CSV file
  • Loops through each row and creates the corresponding Autopilot profile
  • Automatically assigns the profile to the correct dynamic group

Why Automate Autopilot Profiles Using PowerShell?

πŸš€ Save Time – Create and assign dozens of profiles in minutes instead of manually configuring each one in Intune.
πŸš€ Ensure Consistency – Prevent misconfigurations by applying standardized settings across all profiles.
πŸš€ Enable Scalability – Easily support regional device naming conventions without manual intervention.
πŸš€ Improve Efficiency – Integrate with DevOps pipelines for a seamless Infrastructure as Code (IaC) approach.

Final Thoughts

By automating Autopilot profile creation and assignments using PowerShell and the Graph API, IT administrators can simplify deployment management at scale. Whether deploying Windows PCs, HoloLens devices, or managing hybrid join scenarios, this approach ensures faster, error-free deployments.

πŸ”₯ Get started today! Download the script from GitHub and start automating your Autopilot management!

πŸ’¬ Have questions or feedback? Let’s discuss in the comments! πŸš€

Automating Autopilot Profile Creation and Assignments Using PowerShell Graph API for Intune
Tagged on:             

Amir Joseph Sayes

Cloud | EUC | Virtualisation | Enterprise Mobility | DevOps | Automation | Part-Time Blogger | Fitness

One thought on “Automating Autopilot Profile Creation and Assignments Using PowerShell Graph API for Intune

  • May 24, 2025 at 10:54 am
    Permalink

    Thank you very much for creating this πŸ™

    Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Amir Sayes

Subscribe now to keep reading and get access to the full archive.

Continue reading