View and Export Azure AD Guest Users With PowerShell

This blog post will show how to view and export all the guest users inside an Azure Active Directory tenant using the Azure AD PowerShell module.

Guest Users

When guest users are given permissions to access Microsoft 365 resources behind the scenes, they are created in Azure AD, so when there is a need to review all the guest users that have access, we need to use the Azure AD console or PowerShell module.

In this case, the Azure AD module is the only module capable of doing so out of the three available modules for Azure AD.

List Guest users

To list all the guest users who have access to resources inside the tenant, we use the following command.

Get-AzureADUser -Filter "UserType eq 'Guest'" | select DisplayName, Mail

Export Users

To export all the guest users into a .CSV file, use the following command.

Get-AzureADUser -Filter "UserType eq 'Guest'" | select DisplayName, Mail | Export-Csv guests.csv -NoTypeInformation    

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.