Table of Contents
You can use the Azure Active Directory PowerShell module version for Graph for Azure AD administrative tasks such as user management, domain management and for configuring single sign-on. The cmdlets listed here are different from the MSOnline cmdlets which are part of Azure Active Directory PowerShell version 1.0.
Important: Azure AD PowerShell is planned for deprecation. For more details on the deprecation plans, see the deprecation update. You can start trying Microsoft Graph PowerShell to interact with Azure AD as you would in Azure AD PowerShell. In addition, Microsoft Graph PowerShell allows you access to all Microsoft Graph APIs and is available on PowerShell 7.
Installing the Azure AD Module
To install the General Availability version of the module, run:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine -Force;
Install-PackageProvider -Name NuGet -Force;
Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted;
Install-Module -Name AzureAD;
Import-Module AzureAD;
To install the public preview release, run:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine -Force;
Install-PackageProvider -Name NuGet -Force;
Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted;
Install-module AzureADPreview;
Import-Module AzureADPreview;
Connect to Azure AD for your Microsoft 365 subscription
Before you can run any of the cmdlets discussed in this article, you must first connect to your online service. To do so, run the cmdlet Connect-AzureAD at the Windows PowerShell command prompt. You will then be prompted for your credentials.
Connect-AzureAD
After you connect, you can use the cmdlets for the Azure Active Directory PowerShell for Graph module.
Example: Gets subscribed SKUs to Microsoft services.
Get-AzureADSubscribedSku
PS C:\Windows\system32> Get-AzureADSubscribedSku
ObjectId SkuPartNumber PrepaidUnits
-------- ------------- ------------
7299a0f5-1d1d-4990-9826-a7daff5d06b2_1e7e1070-8ccb-4aca-b470-d7cb538cb07e WIN_ENT_E5 class LicenseUnitsDetail {...
7299a0f5-1d1d-4990-9826-a7daff5d06b2_6470687e-a428-4b7a-bef2-8a291ad947c9 WINDOWS_STORE class LicenseUnitsDetail {...
7299a0f5-1d1d-4990-9826-a7daff5d06b2_05e9a617-0261-4cee-bb44-138d3ef5d965 SPE_E3 class LicenseUnitsDetail {...