Recently, I’ve been working on a cheat sheet to collect all the commands needed to connect to Microsoft cloud services. Now I am happy to share this information here on my blog with you. Let’s get started.
Template for Az, AzureAD, ExchangeOnline, MSTeams
The template below shows all of the most important commands for connecting to the Microsoft Cloud services. First, consider the following:
- You need to install the required modules for each cloud service separately. Line 5 – 14 shows the required code
- In the second part (line 20,21) the installation of the required modules is checked
- Each section begins with the connection establishment and ends with a simple command for checking out if the connection was successfully established
<# CONNECT TO MICROSOFT CLOUD SERVICES (Azure, Microsoft 365) Required modules: 1. Az Install-Module Az -Force -AllowClobber 2. AzureAD Install-Module AzureAD -Force -AllowClobber 3. ExchangeOnlineManagement Install-Module ExchangeOnlineManagement -Force -AllowClobber 4. MSTeams Install-Module MSTeams -Force -AllowClobber #> # Check if all required modules are installed: Get-InstalledModule -Name Az,AzureAD,ExchangeOnlineManagement,MSTeams | Select-Object -Property Version,Name,Repository,InstalledLocation ### Credentials $credaz = Get-Credential -Credential patrick.gruenauer@domain.com $credm365 = Get-Credential -Credential patrick.gruenauer@domain.com ### 1. Connect to Azure Cloud ### Connect-AzAccount -Credential $credaz Get-AzVM ### 2. Connect to Microsoft 365 Azure AD Connect-AzureAD -Credential $credm365 Get-AzureADUser ### 3. Connect to Microsoft 365 Exchange Online Connect-ExchangeOnline Get-Mailbox ### 4. Connect to MSTeams Connect-MicrosoftTeams -Credential $credm365 Get-Team
Hope this was helpful and you enjoyed my article. See you next time.
Categories: PowerShell, Microsoft Azure, Microsoft 365
4 replies »