Introduction to the Intune PowerShell SDK: Native PowerShell support for the Intune API through Microsoft Graph!

Microsoft has now released a preview version of the Intune PowerShell SDK. The new Microsoft.Graph.Intune PowerShell module reduces the complexity significantly in enabling automation scenarios for IT Administrators. Connecting with Intune through Microsoft Graph has never been so easy.

The past

Before the Intune PowerShell SDK was released, authenticating with Microsoft Graph required that IT Administrators had to create app registrations and configure them with the required permissions for Windows Azure Active Directory and Microsoft Graph, in each tenant that they manage.

Then, complex scripts were used for retrieving Microsoft Graph authorization tokens, using a combination of the Application ID (which differs in each tenant) and User Credentials. Using this token the Microsoft Graph API was queried, for example using the Invoke-RestMethod cmdlet.

The present

Today, with the Microsoft.Graph.Intune PowerShell Module, you can authenticate to the Microsoft Intune Graph API using User Credentials only, with the use of a single cmdlet: Connect-MsGraph

If you pay close attention, you’ll notice that Microsoft has added a new Enterprise application with a well-known Application ID (“d1ddf0e4-d672-4dae-b554-9d5bdfd93547”) in your Azure Tenant, named ‘Microsoft Intune PowerShell’. This application has preconfigured permissions, which you will need to consent to the application, either for yourself or on behalf of your organization, in order to use the new module.

Download the Microsoft.Graph.Intune PowerShell Module

The Intune PowerShell SDK contains a .NET 4.7.1 release for Windows, and a .NET Standard 2.0 release of the PowerShell Module for any other operating system or platform (including Cloud Shell).

Make sure to check out the README for instructions on how to get started.

If you intend to use the .NET 4.7.1 module on Windows, feel free download and install it directly into your WindowsPowerShell\Modules folder using the script below. The module will be autoloaded, allowing you to run Connect-MSGraph and all other cmdlets included in this module out-of-the-box!

Note:
This requires .NET 4.7.1 installed.
The script below downloads Intune-PowerShell-SDK-Release-6.1811.00642-preview.zip, which is the latest release on the time of writing this post. If a newer version is released that you wish to download with this script, modify the URL first.