Troubleshoot Microsoft 365 Sign-in Issues with Conditional Access PowerShell

A frustrated businesswoman on her phone sits in an airport gate seat with her hand on her carry-on bag, an airliner outside the window.
AI-generated illustration

Updated November 14, 2026 with AI assistance. Vendor references are linked below. Command examples require review for your environment.

Start with the actual sign-in event

Record the user, application, UTC time, correlation ID and failure code. In the Entra sign-in logs, open the event and inspect its Conditional Access details. A policy list alone does not establish which policies applied: exclusions, nested memberships, application targeting, device state, authentication context and other conditions matter.

Read policies with Microsoft Graph

The AzureAD module is retired. Use Microsoft Graph for current scripts. Reading policies, sign-in logs, users and devices requires the corresponding permissions and supported Entra roles. Sign-in reporting availability and retention depend on licensing; confirm the tenant’s requirements.

Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "Policy.Read.All","AuditLog.Read.All","User.Read.All","Device.Read.All"
Get-MgIdentityConditionalAccessPolicy -All | Select-Object Id,DisplayName,State
Get-MgUser -UserId "[email protected]" -Property Id,DisplayName,AccountEnabled,UserPrincipalName
Get-MgAuditLogSignIn -Filter "userPrincipalName eq '[email protected]'" -Top 10

Interpret the result before changing access

Check whether the policy is enabled or report-only, which grant controls were evaluated, and the device information recorded on that event. A registered device is not necessarily compliant. Resolve enrollment, compliance, authentication strength or targeting problems from the evidence. Do not broadly exclude a user or make an ordinary account an emergency-access account to bypass a failure.

Test changes safely

Use Conditional Access What If and report-only evaluation where appropriate, maintain separately controlled emergency-access accounts and use a pilot group. Document the intended result and verify a new sign-in after any approved change. These examples collect information; they do not calculate effective policy for every sign-in.

Sources