Common O365 CmdLets
Install-Module
#Microsoft 365 PowerShell Module
Install-Module MSOnline -Force
# Connect to 365
Connect-MsolService

Set-MSOLUserLicense
​#Set the license type for the user
Set-MsolUserLicense -UserPrincipalName "Dawn@ScriptsbyScott.com" -AddLicenses "ScriptsbyScott:ENTERPRISEPACK"
Get-MSOLUser -All
#List all Users and Licnese and if Licesned
Get-MsolUser -All | select UserPrincipalName,Licenses,IsLicensed,OverallProvisioningStatus

Get-MSOLAccountSKU
#Get Licnese Type & Count Summary
$customformat = @{expr={$_.AccountSkuID};label="AccountSkuId"},
@{expr={$_.ActiveUnits};label="Total"},
@{expr={$_.ConsumedUnits};label="Assigned"},
@{expr={$_.activeunits-$_.consumedunits};label="Unassigned"},
@{expr={$_.WarningUnits};label="Warning"}
Get-MsolAccountSku | sort activeunits -desc | select $customformat

Get-MSOLAccountSKU
​​​​​​​​​​​​​​​​​​​​#Get Service Plan and Status
Get-MsolAccountSku | select -ExpandProperty ServiceStatus

Get-MSOLRole
​​#List all Azure AD Roles
Get-MSOlRole | select Name, Description

Add-MSOLRoleMember
​​​​​#Assign a user to a role
Add-MsolRoleMember -RoleName "Company Administrator" -RoleMemberEmailAddress "elisadaugherty@contoso.com"