Skip to content

Automate the creation of Android Apps in Microsoft Intune

Note: This is only applications for Android ‘legacy applications’. Managed Google Play applications for Android Enterprise devices need to be sync’ed from the Managed Google Play Store.

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.

Adding Android Apps in Intune

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:

  • Name
  • URL
  • Publisher
  • Description
  • MininumAndroidVersion
  • Icon

The script can be split up into 4 different steps

  1. Importing the Intune Module
  2. Import the Applications CSV
  3. Connect to MS Graph
  4. 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

1Connect-MSGraph -AdminConsent

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

1New-DeviceAppManagement_MobileApps

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  

1New-AndroidMinimumOperatingSystemObject

This command has several parameters:

PropertyTypeDescription
v4_0BooleanVersion 4.0 or later.
v4_0_3BooleanVersion 4.0.3 or later.
v4_1BooleanVersion 4.1 or later.
v4_2BooleanVersion 4.2 or later.
v4_3BooleanVersion 4.3 or later.
v4_4BooleanVersion 4.4 or later.
v5_0BooleanVersion 5.0 or later.
v5_1BooleanVersion 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:

1New-AndroidMinimumOperatingSystemObject -application.MininumAndroidVersion $true

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:

1$parameters = @{"v$($application.MininumAndroidVersion)" = $True} $androidVersion = New-AndroidMinimumOperatingSystemObject @parameter

Icons

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

1$iconBytes = Invoke-Webrequest $application.Icon

Script

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

Categories

Intune, Powershell

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: