PowerShell for Microsoft 365 lets you manage your Microsoft 365 settings from the command line. Connecting to PowerShell is a simple process where you install the required software and then connect to your Microsoft 365 organization.
microsoft install azure powershell
if ($PSVersionTable.PSEdition -eq 'Desktop' -and (Get-Module -Name AzureRM -ListAvailable)) {
Write-Warning -Message ('Az module not installed. Having both the AzureRM and ' +
'Az modules installed at the same time is not supported.')
} else {
Install-Module -Name Az -AllowClobber -Scope CurrentUser
}
ps>Install-Module -Name AzureAD
ps>Connect-AzAccount
#if you have multiple subscription
Set-AzContext -SubscriptionId "xxxx-xxxx-xxxx-xxxx"
ps>Connect-AzureAD