Finding Guest Accounts in Microsoft Entra ID with a Pending Invitation Using Read-Only Graph PowerShell
Which Entra ID guests never accepted their invitation? List PendingAcceptance guests read-only with Get-MgUser, and see what the list can and cannot tell you.

Advertising disclosure: this article includes partner links. KBY may earn a commission if you sign up or buy through one, at no extra cost to you. How we make money.
Before you begin
- A Microsoft Entra tenant you are allowed to inspect, ideally a training tenant.
- The Microsoft Graph PowerShell SDK with the Microsoft.Graph.Users module.
- A work or school account with the User.Read.All delegated permission, and no wider one; guests cannot call the list-users API.
Underlined words are defined in the KBY Lexicon. Tap or click one to see what it means.
To find guest accounts in Microsoft Entra ID whose invitation was never redeemed, sign in to Microsoft Graph PowerShell with the read-only User.Read.All permission and run Get-MgUser -Filter "userType eq 'Guest' and externalUserState eq 'PendingAcceptance'" -ConsistencyLevel eventual. Microsoft documents PendingAcceptance as the state a guest keeps until the invitation is accepted, so the result is your list of open invitations. Nothing in the command changes the tenant.
A pending invitation is an account that exists but has never been used, which is why it deserves a look. It is also easy to misread: an empty state is not the same as an accepted one, and an old invitation is not proof that anyone did anything wrong. Build the list, read it carefully and stop short of any change, with the same read-only habits as listing disabled users with read-only Microsoft Graph PowerShell.
#By the end you can
- Explain what a guest account is and what
PendingAcceptanceandAcceptedrecord about it. - Connect to Microsoft Graph PowerShell with one read-only permission and check what the session was granted.
- List guests with a pending invitation, with the properties you need to judge them.
- Say why a null state, an old date or a short list does not settle the question.
- Hand the finding to the person who owns the guest relationship instead of deleting anything.
#Before you begin
- A Microsoft Entra tenant you are allowed to inspect, ideally a training tenant that holds a few invited test guests.
- The Microsoft Graph PowerShell SDK, which provides
Connect-MgGraph, and itsMicrosoft.Graph.Usersmodule, which providesGet-MgUser. - A work or school account that can use the
User.Read.Alldelegated permission. Microsoft states that guests cannot call the list-users API, so do not run this while signed in as a guest.
Microsoft lists User.ReadBasic.All first among the delegated permissions for listing users. This guide uses User.Read.All, because the pages do not say whether the lower permission returns the invitation state, and that state is not in the default property set. The same pages also list User.ReadWrite.All and Directory.ReadWrite.All, which can change things. A tool that only reads should never ask for them.
#How a guest invitation is recorded in Microsoft Entra ID
A guest is a user object whose userType is Guest. When you invite someone through the invitation API, Microsoft Entra ID creates that object straight away, before the person has done anything. Microsoft describes the consent status of such an account as initially PendingAcceptance. It stays there until the guest accepts the invitation and agrees to your privacy policy and terms of use, and then it becomes Accepted.
Two trust boundaries matter. The account is created in your directory, so it already shows up in searches, groups and sharing pickers, even though no one has signed in. And the invitation lives in an email sent to an address you typed, so the object proves only that you invited something, never that the right person received it.

#The properties you will read
Microsoft documents externalUserState as the invitation status of a guest invited through the invitation API. The state can be PendingAcceptance or Accepted, or null for all other users. externalUserStateChangeDateTime is the timestamp of the latest change to that state. createdDateTime is when the object was created and cannot be modified. All three need $select to be returned, which in PowerShell means -Property, and the two state properties support $filter with eq, ne, not and in.
#Why null is its own answer
The documentation says null applies to all other users. A guest added by some route other than the invitation API may therefore carry no invitation state at all. Treat a null as unknown, the same way you would treat any missing field: it does not tell you the guest signed in, and it does not tell you they never did.
#A worked example: the invitation nobody followed up
Suppose a small training company invites contractors for each course. The example is invented to show the reasoning; the names and dates are not from a real tenant. A year on, an administrator is asked whether any guests were invited and never joined. They run the listing from the exercise below and sort it by CreatedDateTime. Illustrative output:
| DisplayName | UserType | ExternalUserState | CreatedDateTime |
|---|---|---|---|
| Contractor A | Guest | PendingAcceptance | 2026-01-14 |
| Contractor B | Guest | PendingAcceptance | 2026-09-30 |
| Contractor C | Guest | PendingAcceptance | 2026-11-27 |
Contractor C was invited last week, so the invitation is probably still in an inbox and there is nothing to do. Contractor B was invited two months ago, which is worth a question to whoever invited them.
Contractor A is almost a year old, and that account has been in every group picker since January. The list cannot say why. It can only point at who to ask, and the answer may be that A joined the course under a different address.
#Your turn: list the pending guests in your tenant
Objective. Produce a count and a short table of guests whose invitation is pending, plus a note of what the list cannot tell you. Safe setup. Every command reads. Do not run any cmdlet whose name begins New-, Update- or Remove- against users.
- Connect with one read-only scope:
Connect-MgGraph -Scopes "User.Read.All". Sign in when prompted and consent only if the prompt names that permission. - Check what you were granted with
Get-MgContext. Look atScopesandAuthType. You expect the scope you asked for and a delegated session. - List the guests:
$pending = Get-MgUser -All -ConsistencyLevel eventual -CountVariable n -Filter "userType eq 'Guest' and externalUserState eq 'PendingAcceptance'" -Property Id,DisplayName,Mail,UserType,ExternalUserState,ExternalUserStateChangeDateTime,CreatedDateTime,AccountEnabled. The-Allswitch follows every page, and the header keeps the query valid if Graph treats the filter as an advanced one. - Count them with
$pending.Count. - Show the oldest first:
$pending | Sort-Object CreatedDateTime | Format-Table DisplayName, Mail, CreatedDateTime, ExternalUserStateChangeDateTime, AccountEnabled. - List every guest regardless of state, to see what the filter left out:
Get-MgUser -All -ConsistencyLevel eventual -CountVariable m -Filter "userType eq 'Guest'" -Property Id,ExternalUserState | Group-Object ExternalUserState | Select-Object Count, Name. A blank name is the null group. - End the session with
Disconnect-MgGraph.
Following along? Tap a step’s number to tick it off.
Expected evidence. Step 2 shows your requested scope and a delegated auth type. Step 4 gives a whole number, possibly zero. Step 5 shows one row per pending guest. Step 6 gives a count for each state, and the counts should add up to the number of guests you see in the admin center.
Pass condition. You can write: “On [date], with User.Read.All, the tenant had [n] pending guest invitations, the oldest created on [date], and [m] guests with no invitation state.” You can also name one thing the list does not tell you.
Stop condition. Stop if the sign-in asks for a scope with ReadWrite in its name, or if you are asked to approve something on behalf of the whole organisation that you did not expect. Cancel and ask the owner of the tenant. Cleanup. Run Disconnect-MgGraph. Nothing was changed, so nothing needs rolling back.

#How to check that the list told the truth
Run Get-MgContext first. A session with only User.Read.All and an AuthType of Delegated is the session you meant to have. Then run the count twice, a minute apart. The same whole number both times suggests you followed every page and nobody changed state in between. A different number is not an error: someone may have accepted an invitation in the meantime.
Next, compare one row by hand. Open the guest in the Microsoft Entra admin center and read its invitation state, and check that the creation date matches what PowerShell returned. Finally, check the arithmetic in step 6: pending plus accepted plus null should equal the guest total. If it does not, one query missed a page or a filter behaved differently from the way you expected.
#What goes wrong when you list pending guests
- Treating the list as a clean-up list. Pending means the guest has not accepted yet. It does not mean the guest is unwanted. Someone may be on leave, or the invitation email may have landed in a junk folder.
- Reading null as accepted. The documentation says null applies to users other than invited guests, so a guest without a state is unclassified.
- Forgetting the header. Microsoft says some filtered queries need
ConsistencyLevelset toeventualand$count. If a filtered call is rejected, add them rather than widening permissions. - Stopping at one page. Without
-Allyou get only the first page and an undercount. - Leaving the session open. The sign-in persists across PowerShell sessions until you run
Disconnect-MgGraph.
If a call is refused or properties come back empty, the account lacks the permission or consent. Ask the owner of user administration for read access and do not choose a wider scope yourself.
If the numbers look wrong and you cannot explain them, stop and escalate; do not edit users to make them match. A guest that cannot sign in at all is a different question, covered in finding why a sign-in failed in the Microsoft Entra sign-in logs.
#Taking pending guests into production
Run this in production only when you have a reason and read access already. Use a named account, record the date, the permission and the counts, and keep the output where only people entitled to see user email addresses can read it. The listing includes real names and mail addresses, so a screenshot in a chat channel is a disclosure.
Acting on the list is a separate decision. Removing a guest, or resending an invitation, changes the tenant and may remove access someone relies on, so it needs the sponsor of the relationship, a change record and a backup of what the account could reach. Neither is covered here.
Groups are the part to look at first: a guest in a group inherits what the group grants, and a rule-based group such as one built in a dynamic membership group in Microsoft Entra ID can include guests without anyone choosing them. Do not assume either way; read the rule.
#What to remember about pending invitations
- A guest object exists from the moment of invitation, and
PendingAcceptancelasts until the guest accepts. - Null state means not invited through the invitation API or unclassified, not accepted.
- Use
User.Read.Allonly, with-All,-Propertyand a read-only filter. - Age is a reason to ask, not a verdict.
- Report counts with the date and permission, and hand removal to the owner of the relationship.
About this page
Credited to
Dates
Published
Sources
Corrections
No corrections are listed for this page. Some review sweeps corrected pages without naming each one; those are in the corrections log.
Found this useful? Follow KBY for more like it.
Recommended reading
More from KBY that goes with this article.

- Microsoft Entra ID error
AADSTS50020: user from another identity provider doesn't exist in the tenant
2 min read
Related articles
Identity and Access Management
Listing Disabled Users in Microsoft Entra ID with Read-Only Microsoft Graph PowerShell
List disabled Entra ID users with Get-MgUser and User.Read.All: filter accountEnabled, select properties, page with -All, count, export and disconnect.
ReadIdentity and Access Management
Setting Up Recurring Entra ID Access Reviews for Guests
A production runbook for junior identity engineers to configure, pilot and audit recurring Entra ID access reviews of guest accounts using Microsoft Graph PowerShell.
ReadSecurity
Azure API Management CVE-2026-139934 Added to CISA’s Exploited List: Rotate Secrets Now
CISA lists the Azure API Management Classic flaw as exploited. Microsoft's fix does not invalidate stolen credentials, so stored secrets still need replacing.
ReadCloud and SaaS
Entra Backup and Recovery Premium Preview: 30 Days of Backups at $0.025 per Object
Entra's Premium backup plan keeps 30 days instead of 7 and bills per object. What it covers, what it misses and what to count before you switch it on.
ReadDiscover more
Graduate Learning
- TutorialAuditing Privileged Role Assignments in Microsoft Entra ID with Read-Only Microsoft Graph PowerShell
- TutorialListing Disabled Users in Microsoft Entra ID with Read-Only Microsoft Graph PowerShell
- TutorialRevoking a User’s Sessions in Microsoft Entra ID After a Suspected Account Compromise
- TutorialFinding Why a User’s Sign-In Failed in the Microsoft Entra Sign-In Logs
Ops Playbook
- PlaybookPilot Entra ID Passkey Profiles With Attestation Before Rolling Out Passkeys Tenant Wide
- PlaybookProve Your Entra ID Break-Glass Accounts Still Work With a Quarterly Sign-In Drill
- PlaybookRetire SMS and Voice MFA in Entra ID Without Locking Users Out
- PlaybookRequire Phishing-Resistant MFA for Entra ID Admins With Authentication Strengths
Lexicon Definitions
Was this useful?
Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.
Build practical engineering skills.
Receive new lessons, learning paths, practical exercises and early-career guidance.
Comments
Add a thoughtful note on Finding Guest Accounts in Microsoft Entra ID with a Pending Invitation Using Read-Only Graph PowerShell. Comments are checked for spam and held for moderation before appearing.