A few weeks ago the Intune team released a preview of the Intune Powershell SDK (Microsoft Intune Powershell preview releases! – Orbid365), after the release I started to experiment with these cmdlets.
Adding iOS apps in Intune is very simple because you can browse the iOS store directly through the Intune portal, adding Android apps is a lot more time consuming. You have to fill-in all the App Information yourself.
That’s why I decided to create a script that automates the addition of Android Applications into Intune. The script adds Android apps through a CSV-file and I decided to take the newly generated Powershell CMDlets for a testrun!
The CSV file has the following headers:
The script can be split up into 4 different steps
- Importing the Intune Module
- Import the Applications CSV
- Connect to MS Graph
- Add the applications
If you have never used the Intune SDK before, you need to run the Connect command with the AdminConsent parameter before executing the script
This accepts the permissions that the SDK requires to configure your Intune environment.
Minimum Android Version
During the process of writing the script, I ran into a few problems.The command for adding applications is
This requires the –minimumSupportedOperatingSystem parameter which needs a AndroidMinimumOperatingSystemObject that specifies what the minimum Android OS version should be for the specific application. A AndroidMinimumOperatingSystemObject can be created through the command
This command has several parameters:
|v4_0||Boolean||Version 4.0 or later.|
|v4_0_3||Boolean||Version 4.0.3 or later.|
|v4_1||Boolean||Version 4.1 or later.|
|v4_2||Boolean||Version 4.2 or later.|
|v4_3||Boolean||Version 4.3 or later.|
|v4_4||Boolean||Version 4.4 or later.|
|v5_0||Boolean||Version 5.0 or later.|
|v5_1||Boolean||Version 5.1 or later.|
Source: Microsoft Graph Documentation
The CSV has a parameter called ‘MininumAndroidVersion’, which has the form ‘4_0’. If you try to use the command:
where ‘application.MininumAndroidVersion’ is 4.0. Powershell throws an exception because it sees the parametername as a string. The wordaround for this is to create a hash table with the parameter and provide this hash table to the command.
The code for this looks like this:
This script is currently configured to use icons that are stored locally on the computer. If you want the script to download the icon from the web, just change line 169 to
The script full script can be found on my Github account. Download it and start automating! Github Link
This blogpost was originally posted at Orbid 365