Well, this is just some notes on how to prepare PowerShell to manage Azure Active Directory and Office 365. But similar to connecting to AD in Azure, you also need to go through these steps to connect PowerShell to an Azure subscription.
This is quite interesting actually when I put them together. As AAD still has two active environment versions, same as Azure console – Classic and RM – they belong to different logins, a little confusing to admins. Also PowerShell modules need to be installed and updated to enable different cmdlets set in order to manage different products – cloud, non-cloud, 3rd-parties like AWS, etc. So when something is not working, maybe you are in a wrong dimension or Microsoft wants you to update the binary you are using.
Azure Subscription | AAD Module v1 (MSOnline) – General Availability version – Public Preview version |
AzureAD v2 – General Availability version – Public Preview version |
Pre-requisites: – Install lastest Azure Tools using Web Platform Installer > Add-AzureAccount > Get-AzurePublishSettingsFile > Import-AzurePublishSettingsFile > Select-AzureSubscription |
Pre-requisites: MS Online Services Sign-in Assistant Windows AAD Module for Windows PowerShell |
Pre-requisites: PowerShellGet |
Step 1: Install Azure PowerShell Install-Module AzureRM |
Download and install Azure AD Connect (.msi) Update AAD Module > 1.0.8070.2 |
Download from PS Gallery Install AAD Module Update AAD Module |
Step 2: Connect to an Azure account Login-AzureRmAccount |
Connect to Azure AD
$Msolcred = Get-credential |
Connect to AAD
$AzureAdCred = Get-Credential |
Step 3: Run Azure PowerShell cmdlets | v1 cmdlets are here | v2 are here |
More information: | PowerShell Gallery | Office 365 PowerShell |
One more thing: remember to check the update time of anything posted online, those older than 3 months might be useless.