How to install Azure AD preview module with PowerShell?
In order to use new functionality within Microsoft 365, Teams or Azure it is sometimes necessary to log in with PowerShell log in. In this practical guide you can get started with installing the necessary Azure AD Preview module. Some example scripts are described in the article.
Open Powershell as administrator
Install the PowerShell module from Azure AD
Run the following line in PowerShell:
install-package -Name AzureAD
Connect to AzureAD
Changing a UPN via PowerShell
Set-MsolUserPrincipalName -UserPrincipalName email@example.com -NewUserPrincipalName firstname.lastname@example.org
If your script does not work, install the MSOnline module
Install-Module -Name MSOnline
Connect to Azure AD