Skip to content

Instantly share code, notes, and snippets.

@JanVidarElven
Created July 15, 2016 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JanVidarElven/783295e9c4bc0da63cc71eb7833535c0 to your computer and use it in GitHub Desktop.
Save JanVidarElven/783295e9c4bc0da63cc71eb7833535c0 to your computer and use it in GitHub Desktop.
Group on UPN Suffixes used in Azure Active Directory
# Require the Azure Active Directory PowerShell Module
Import-Module MSOnline
# Credential and Connect
$msolcred = Get-Credential
Connect-MsolService -Credential $msolcred
# Group count of all UPN suffixes in your Azure AD
Get-MsolUser -All | Select UserPrincipalName, @{Name="UPNSuffix"; Expression={($_.UserPrincipalName.Split("@",2)[1])}} | Group UPNSuffix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment