How do you distribute configuration profile, apps or other configurations in Intune today? In this blog I want to explain and provide a script how you can easily roll out objects in Intune using waves. Here I will help you to create groups defined by you that will pack a specified percentage of your devices into the groups so that you can perform a slow rollout and thus guarantee the quality. The current script describes how you can create device groups. When you validate these rollout waves, it can also be helpful to get assignments of a device via PowerShell. If you are also interested in how to apply this to user groups or how to create a automation for the assignment, check out my new version of the Intune group assignment script.

How can I get the script?
You can find the script in my GitHub repository.
What I have to do before running the script?
Before running the script you have to define the tenant Id, the client secret and the app Id from your app registration. How to create an app registration you can find below.
In addition to this you have to define the group names for the different waves and the percentage how many devices should be added to this group. If you want to have more groups you only have to add the following line:
$groups += '{"GroupName" : "NAME_OF_THE_GROUP" : "NUMBER_OF_PERCENTS"}' | ConvertFrom-Json
Currently the script use all devices as scope. It is very important to add filters to get only the required devices. How to filter is explained below. If you are working with Intune app targeting, also keep the Applicability Rule behavior in mind.

How to add filter to the call?
You can find in the script an example filter. But you can filter for more or less all attribute you have within the graph object.
The best way is to create the filter via the graph explorer. For this run a query for https://graph.microsoft.com/beta/devices and add ?$filter= and add your filter condition. More informations can be found the Microsoft documentation.
Example:
?$filter=operatingSystem eq 'Windows'
How can I create an app registration?
- Search for Microsoft Entra ID

- Select App registration

- Select +New registration

- Enter a Name and click Register

- Click API permissions and +Add a permission

- Select Microsoft Graph

- Select Application permissions

- Search for Group.ReadWrite.All and Device.Read.All

- Click Grant admin consent for *** and approve with Yes

- Select Certificates & secrets and click +New client secret

- Enter a Description and select a Expires time
- Click Add

- Copy and save the Value and the Secret ID

How does it work and how can I use this groups?
The script will create the groups with the size defined by you.

You can attach these groups in newly created configuration profiles, apps and all other Intune objects. You can start with the first group to test your configuration on a few devices and attach the next group after one or two days. Finally, you can either append the last group or remove everything else and apply the configuration to all devices. Of course you can also use for the assignment filter
If you want to continue with a related automation scenario, check out how to convert Intune device groups to user groups via Microsoft Graph API.
https://github.com/JayRHa/Intune-Scripts/blob/main/Create-DeploymentGroups/Create-WaveDeplyomentGroups.ps1 is broken! not found page!
Thank you have fixed the link
This is a great post, exactly what I was looking for to create deployments in our enterprise because we are so large. If you can do a write-up for doing the same thing for users that would be great!
Will work on this
it seems it picks only 100 devices, due to limit in API call. Would you be able to add @odata.nextLink, till it reads the last record 🙂
Let me include this
I fixed this can you test this and give me feedback pls
Great idea, Jannik! Thanks for sharing this. It is an extremely useful script for making ready for phased deployments -a must have and huge timesaver.
For those interested, I rewrote it using MSGraph PowerShell SDK and added a bit of logic.
https://endpointers.wordpress.com/2023/03/28/create-phased-deployment-groups/
Thanks for making an rework 😀
It works perfectly!. Thank you!. Is there anyway that we can scope this script to a existing AAD group, so that it will add devices only from that group?
Yes sure this is possible. Do you need support to adapt the script to do this?
Great. I did manage to modify the script to get members from existing AAD group. Thanks a lot. Since we have 9k+ devices, the script runs more than an hour and access token expires, in the mid of third group creation. I am just working on that to refresh/reissue the access token.