To find guests with access to Azure, list each subscription's role assignments made to users, look each user up in Microsoft Entra ID and keep those whose user type is Guest. A guest can also hold a role through a group, so check the members of any group that has an assignment.
| Method | Best fit |
|---|---|
| PowerShell | A CSV of every role a guest holds directly across your enabled subscriptions. |
| Admin centre | A quick look at 1 guest's Azure roles. |
| Altivane | Recommended for regular access reviews, with guests and direct assignments listed in a workbook to keep. |
Before you start
Use an account that can read role assignments at the scopes you want to check, such as one with the built-in Reader role, and that can read users in the directory. A member account can by default; a guest account has restricted directory permissions and can't look the users up. The script reads each user's UserType through Microsoft Graph with the same Azure sign-in. Microsoft lists no separate licence for reading assignments.
A guest is a user invited from another organisation through Microsoft Entra B2B collaboration. The examples list the roles a guest holds directly; a role held through a group shows as the group's assignment. They read and export, and change nothing. The script's finally block disconnects the account and clears its saved Azure contexts.
Option 1
Find guests with access to Azure with PowerShell
Install the modules once. The script reads the user assignments of each enabled subscription, looks up each user's type once, and saves the assignments held by guests.
Install-Module -Name Az.Accounts, Az.Resources -Repository PSGallery -Scope CurrentUser$ErrorActionPreference = 'Stop'
Connect-AzAccount -ErrorAction Stop
try {
$subscriptions = @(Get-AzSubscription | Where-Object State -eq 'Enabled')
if ($subscriptions.Count -eq 0) {
Write-Output 'No enabled subscriptions are available to this account.'
return
}
$assignments = @{}
foreach ($sub in $subscriptions) {
Set-AzContext -Subscription $sub.Id -Tenant $sub.TenantId -Scope Process | Out-Null
Get-AzRoleAssignment | Where-Object ObjectType -eq 'User' |
ForEach-Object { $assignments[$_.RoleAssignmentId] = $_ }
}
$userType = @{}
$ids = @($assignments.Values | ForEach-Object ObjectId | Sort-Object -Unique)
foreach ($id in $ids) {
$user = Get-AzADUser -ObjectId $id -Select 'UserType' -AppendSelected
$userType[$id] = $user.UserType
}
$rows = @($assignments.Values | Where-Object { $userType[$_.ObjectId] -eq 'Guest' } |
Sort-Object SignInName, Scope)
if ($rows.Count -eq 0) {
Write-Output 'No guest holds an Azure role directly.'
} else {
$rows | Select-Object DisplayName, SignInName, RoleDefinitionName, Scope,
ObjectId, RoleAssignmentId |
Export-Csv -Path './azure-guest-access.csv' -NoTypeInformation -Encoding utf8
Write-Output "$($rows.Count) guest assignments saved to azure-guest-access.csv."
}
} finally {
Disconnect-AzAccount | Out-Null
}The CSV holds the guest's name and sign-in name, the role, the scope, the object ID and the assignment ID. An assignment at a management group or the root is read from every subscription it reaches, so the script keeps each assignment ID once. To narrow the check, filter $subscriptions, or add -RoleDefinitionName 'Owner' to Get-AzRoleAssignment to keep 1 role.
See every role 1 guest holds
Reconnect, then read 1 guest's assignments in the current subscription, including the roles held by the groups they belong to.
# Run while connected to Azure. Replace the example object ID.
Get-AzRoleAssignment -ObjectId '00000000-0000-0000-0000-000000000000' -ExpandPrincipalGroups |
Select-Object DisplayName, RoleDefinitionName, ScopeOption 2
Review a guest's Azure roles in the Azure portal
- Sign in to the Azure portal with an account that can read the directory and the subscriptions' role assignments.
- Choose All services > Microsoft Entra ID > Users.
- Select Add filter, choose User type and select Guest.
- Select a guest, then Azure role assignments, to list the roles assigned to them at each scope you can read.
- To see another subscription, choose it in the Subscriptions list.
This suits a check of a few named guests. It works through 1 guest and 1 subscription at a time, so for every guest across every subscription, use PowerShell or Altivane.
Option 3 ยท Recommended for regular access reviews
Find guests with Azure access with Altivane
- Open Altivane and choose the tenant.
- Run the Azure Access to Review report.
- Open the Excel workbook and find Guests with access: each role assignment held by a guest, with the role, the scope, what it is on and the subscription.
- Read Users assigned directly at a subscription or above for members and guests given a role there without a group.
The report covers every subscription where you gave Altivane the Reader role. Like the PowerShell example, it lists roles assigned to the guest, so a guest who holds a role through a group is in that group's row. When the names can't be read, the table is left empty with a note saying so and the report is marked partial, rather than reporting no guests. The Azure Access scorecard report counts guests with a role for the tenant's Word report.
Contact usCommon questions
A guest has access but isn't in the list. Why?
The role is most likely held through a group. Run Get-AzRoleAssignment with the guest's object ID and -ExpandPrincipalGroups, as above, to see the roles their groups hold.
Why does the script stop when it looks up a user?
The account can't read users in the directory, which is usual for a guest account. Run it again with a member account, or one that holds the Directory Readers role.
How do I find guests who never accepted their invitation?
That is a question about the guest accounts, not their Azure roles. See how to list guest users in Microsoft Entra ID.
Microsoft references
Technical references checked on 6 November 2026. The example scripts have been reviewed and syntax checked; they have not been run against a live tenant.
- Install-Module cmdlet reference
- Connect-AzAccount cmdlet reference
- Set-AzContext cmdlet reference
- Get-AzRoleAssignment cmdlet reference
- Get-AzADUser cmdlet reference
- Disconnect-AzAccount cmdlet reference
- Assign Azure roles to external users using the Azure portal
- List Azure role assignments using the Azure portal
- Properties of B2B guest users