Install AzureAD Powershell module

MS Online is an old module to manage the Azure/Office 365 from PowerShell.

Azure Active Directory PowerShell for Graph (AzureAD) is a modern PowerShell module for interacting with Azure infrastructure. The module is being actively developed, new features are being added (analogs of almost all MSOnline cmdlets are available).

Azure PowerShell module requires at least PowerShell version 5.1

First Check the installed powershell version

$PSVersionTable.PSVersion

Install the AAD powershell module with this command : Install-Module -Name AzureAD 

You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet.

You need to run this command if you received the error above.

Set-PSRepository -Name PSGallery -InstallationPolicy Trusted

 check the version of the AzureAD module:

Get-Module AzureAD –ListAvailable

list of available cmdlets in the module as follows:

Get-Command –Module AzureAD

Update-Module -Name AzureAD

Update-Module -Name AzureAD -RequiredVersion 2.0.2.120

Connect-AzureAD

Disconnect-AzureAD

f you have Azure MFA enabled, confirm sign-in on your device.

You can also get connection credentials in PowerShell and save them into a variable:

$AzureADcreds = Get-Credential

Then you can use it for connection:

Connect-AzureAD -Credential $AzureADcreds

Get-AzureADTenantDetail

Get-AzureADUser -SearchString Max

Get-AzureADGroup

Get-AzureADSubscribedSku | select SkuPartNumber, ConsumedUnits

Get-AzureADUser -SearchString [email protected] | Select -ExpandProperty AssignedLicenses

Get-AzureADSubscribedSku | Where {$_.SkuId -eq “7654321-babb-1234-ababa-2d2345678905”}

Leave a Reply

Your email address will not be published.