Step 1: Install Azure AD PowerShell Module
First, you have to install Microsoft Online Services Sign-In Assistant, the Sign-In Assistant provides end user sign-in capabilities to Microsoft Online Services.
#1 Install Microsoft Online Services Sign-In Assistant for IT Professionals RTW
#2 Then install the Azure Active Directory Module for Windows PowerShell.
– For 64-bit machine
– For 32-bit machine
Step 2: Connect to Azure AD
Once you have installed all the required components, you must first import Azure AD powershell module by running the following command.
Import-Module MSOnline
Then connect to your online service. Run the below script to connect Azure AD online service.
$msolCred = Get-Credential Connect-MsolService –Credential $msolCred
Now, you can manange your connected online Azure AD service through Azure AD PowerShell cmdlets, such as Get-MsolUser, Set-MsolUserPassword, etc..
Example:
The following command retrieves the office 365 user with the UPN [email protected]
Get-MsolUser -UserPrincipalName [email protected]