Table of Contents
Azure Active Directory (MSOnline)
You can use the Azure Active Directory Module for Windows PowerShell cmdlets for Azure AD administrative tasks such as user management, domain management and for configuring single sign-on.
Install the Azure AD Module
The easiest way to install the module is from the PowerShell Gallery. You can install the module with the Install-Module cmdlet:
Right click on the Windows Start icon then open Windows PowerShell Admin. In Windows 11, select Terminal Admin.
Run the following command to install Azure AD Module:
Install-Module MSOnline -Force
Connect to Azure AD
You must first connect to your online service. To do so, run the cmdlet Connect-MsolService at the Windows PowerShell command prompt.
Connect-MsolService
You will then be prompted for your credentials. Let’s login using an administrative account.
If you get no error, it means you’ve connected. Alternatively, you can run a MSOL command to verify it works. For example, we’ll run Get-MsolUser to get the list of users in our tenant.
PS C:\> Get-MsolUser
UserPrincipalName DisplayName isLicensed
----------------- ----------- ----------
[email protected] Marketing False
[email protected] Ben True
[email protected] Bon Ben True
[email protected] Chris True
[email protected] Noreply True
[email protected] Tonny True
[email protected] VIP01 True
[email protected] Info False
[email protected] Max True