As promised last week, here is part 2 of my time-based group membership. In this part, I will show you, how you can use the backend from part 1 to allow admins to add Intune managed devices to the group using a PowerApp.
![](https://mikemdm.de/wp-content/uploads/2024/06/Screenshot-2024-06-09-121406.png)
PowerApp
Let’s start with importing the PowerApp:
![](https://mikemdm.de/wp-content/uploads/2024/06/Screenshot-2024-06-09-130438-1024x602.png)
You can find the sources on my GitHub: https://github.com/mmeierm/Scripts/blob/main/Time-based-Groupmembership/TimeBasedGroups_20240609105421.zip
![](https://mikemdm.de/wp-content/uploads/2024/06/Screenshot-2024-06-09-130532-1024x609.png)
![](https://mikemdm.de/wp-content/uploads/2024/06/Screenshot-2024-06-09-130601-1024x789.png)
![](https://mikemdm.de/wp-content/uploads/2024/06/Screenshot-2024-06-09-130634-1024x792.png)
App registration
For the newly created Get-Devices Flow, we need an Entra App registration, to get the permissions to list all Intune Devices.
![](https://mikemdm.de/wp-content/uploads/2024/06/Screenshot-2024-06-09-131023.png)
Give it a name:
![](https://mikemdm.de/wp-content/uploads/2024/06/Screenshot-2024-06-09-131127.png)
Next, we can assign the needed Graph API permission
![](https://mikemdm.de/wp-content/uploads/2024/06/Screenshot-2024-06-09-131211-1024x577.png)
![](https://mikemdm.de/wp-content/uploads/2024/06/Screenshot-2024-06-09-131233.png)
We need the Permission “DeviceManagementManagedDevices.Read.All” to read all Intune Devices:
![](https://mikemdm.de/wp-content/uploads/2024/06/Screenshot-2024-06-09-131307-1024x750.png)
Grant admin consent:
![](https://mikemdm.de/wp-content/uploads/2024/06/Screenshot-2024-06-09-131358-1024x573.png)
And create an app secret, that we will use in our Flow:
![](https://mikemdm.de/wp-content/uploads/2024/06/Screenshot-2024-06-09-131432-1024x598.png)
Make sure, to save the secret somewhere secure, since you can’t view it later:
![](https://mikemdm.de/wp-content/uploads/2024/06/Screenshot-2024-06-09-131516-1024x579.png)
Power Automate Flow
Now that we have the needed prerequisites, we can modify our Power Automate Flows to match our environment. You should be able to see the two fresh created flows, which are still disabled:
![](https://mikemdm.de/wp-content/uploads/2024/06/Screenshot-2024-06-09-132741-1024x335.png)
Let’s start with the “TimeBased-Get-Devices” flow, we have to edit the HTTP step, to add the Tenant ID, the Client ID and the secret of the App registration, that we just created.
![](https://mikemdm.de/wp-content/uploads/2024/06/Screenshot-2024-06-09-132829-1024x707.png)
![](https://mikemdm.de/wp-content/uploads/2024/06/Screenshot-2024-06-09-133130-1024x793.png)
Once you save the changes, we can turn on the flow and go to the next flow:
![](https://mikemdm.de/wp-content/uploads/2024/06/Screenshot-2024-06-09-133236-1024x646.png)
In the “TimeBased-Add-Devices” flow, we again just have to modify the HTTP step, we need to add the Webhook URL from the Azure Automation Runbook of part 1 and the GroupID of the Time-based Entra Group:
![](https://mikemdm.de/wp-content/uploads/2024/06/Screenshot-2024-06-09-133432-1024x767.png)
Once this is done and the flow is enabled, we should be good to go.
![](https://mikemdm.de/wp-content/uploads/2024/06/Screenshot-2024-06-09-133842-1024x660.png)
Admin experience
You can start the App and search for a Serial Number of any Intune Device:
![](https://mikemdm.de/wp-content/uploads/2024/06/Screenshot-2024-06-09-134136-1024x495.png)
At the first start, you need to approve the connection to Office 365 to allow us to show your profile picture:
![](https://mikemdm.de/wp-content/uploads/2024/06/Screenshot-2024-06-09-134533.png)
![](https://mikemdm.de/wp-content/uploads/2024/06/Screenshot-2024-06-09-134612.png)
Once you found the device that you want to add, you can simply click on it, to see more details:
![](https://mikemdm.de/wp-content/uploads/2024/06/Screenshot-2024-06-09-134833.png)
![](https://mikemdm.de/wp-content/uploads/2024/06/Screenshot-2024-06-09-134906.png)
If you are happy with your choice, you can click on “Add Device”, which will start the Azure Automation Runbook from part 1:
![](https://mikemdm.de/wp-content/uploads/2024/06/Screenshot-2024-06-09-135357-1024x643.png)
Conclusion
If you don’t feel comfortable with the user self-service from part 1 which has a potential risk of misuse through the end user, or you just want to have an additional way to use the time-based device groups, you now have the option. This variant also has the potential to allow your first level support guys to have a quick and easy way to help your users, without needed to have high privileged roles.
Leave a Reply