--- title: "Investigate Conditional Access Sign-In Logs and Policy Configuration" slug: "dex-wf-investigate-conditional-access-sign-ins" updated: 2026-11-30T16:15:51Z published: 2026-11-30T16:15:51Z canonical: "documentation.sysaid.com/dex-wf-investigate-conditional-access-sign-ins" --- > ## Documentation Index > Fetch the complete documentation index at: https://documentation.sysaid.com/llms.txt > Use this file to discover all available pages before exploring further. # Investigate Conditional Access Sign-In Logs and Policy Configuration Analyze Entra ID sign-in telemetry and Conditional Access policy posture to surface failures, gaps, and policy evaluation patterns. **Complexity:** Intermediate. **Impact:** security + compliance + access-control + audit. ## Why use this workflow Conditional Access (CA) is the primary access control plane for Microsoft 365 and Entra ID. When users report being blocked, when you suspect risky sign-ins, or during a routine security review, you need visibility into two things at once: **what the sign-in logs show** (who signed in, from where, which policies fired, what results) and **what is actually configured** (custom CA policies vs. Security Defaults). Run this workflow when: - Users report unexpected MFA prompts, blocks, or access denials - You perform a monthly or quarterly security posture review - You suspect a compromised account (risky sign-ins, unfamiliar locations) - You validate that newly deployed CA policies are firing as expected - You audit a tenant that relies only on Security Defaults and want to understand exposure The output is a consolidated picture: top policies by evaluation volume, policies with the highest failure rate, failed sign-ins with error codes and locations, and the list of configured CA policies (or confirmation that only Security Defaults is active). ## Expected outcomes - A breakdown of recent sign-ins by `conditionalAccessStatus` (success, failure, notApplied) - Per-policy statistics: how often each CA policy was evaluated and its success and failure rate - A list of failed sign-ins with error codes, failure reasons, IP addresses, and geolocation - An inventory of configured Conditional Access policies, their state (enabled, disabled, or report-only), and enforced grant controls - A clear indication of whether the tenant is protected by custom CA policies or only Security Defaults - Actionable recommendations for policy gaps (for example, missing MFA for admins, or legacy authentication not blocked) ## Risks and considerations ### Things to watch for - **Read-only operation.** This workflow only inspects data. It does not modify policies. Still, treat sign-in data as sensitive PII: it contains usernames, IP addresses, and geolocation. - **Licensing requirement.** Full sign-in log access through Graph requires **Entra ID P1 or P2**. Tenants on the free tier get limited or empty results. - **Security Defaults vs. CA.** When Security Defaults is enabled, sign-ins typically show `conditionalAccessStatus: notApplied` because Security Defaults does not use the CA evaluation engine. That is *not* a misconfiguration, but it *is* a signal that you lack granular control. - **Log latency.** Sign-in events can take some time to appear in the audit log. Recent events may be missing. - **Data retention.** Sign-in logs are retained for 7 days (free) or 30 days (P1 or P2). For longer retention, stream to Log Analytics or Microsoft Sentinel. - **Do not disable Security Defaults** without first creating equivalent or stronger custom CA policies. Otherwise you leave the tenant exposed. - **PII handling.** Store exports from this workflow in compliance with your data retention and privacy policies. ## Required permissions | Permission | Why it's needed | | --- | --- | | AuditLog.Read.All | Read Entra ID sign-in logs including Conditional Access evaluation details | | Policy.Read.All | Enumerate configured Conditional Access policies and their settings | | Directory.Read.All | Resolve user, group, and application display names referenced by policies | ## Ask Dex Paste the prompt into a Dex conversation. ### Prompt for IT admins ``` Investigate Conditional Access activity for the last {days} days. Pull sign-in logs, summarize results by CA status, identify failures with error codes and locations, enumerate configured CA policies and Security Defaults state, and flag any policy gaps (e.g., no MFA-for-admins, legacy auth not blocked). Scope to {user_principal_name} if provided. ``` ### How an end user can ask Dex ``` I keep getting blocked or asked for extra MFA prompts when I try to sign in - can you check what's happening with my account? ``` ## Manual steps (admin center) ### Part 1: Review sign-in logs 1. Go to the [Microsoft Entra admin center](https://entra.microsoft.com) and sign in as a Global Reader, Security Reader, or Global Administrator. 2. Go to **Identity** > **Monitoring & health** > **Sign-in logs**. 3. Set the time window. Use the **Date** filter to widen it as needed. 4. Select **Add filters** and add `Conditional Access`. Filter by: - **Success:** policies evaluated and granted access - **Failure:** sign-ins blocked by CA - **Not applied:** no policy matched (or Security Defaults in use) 5. Select any sign-in row to open the details pane. Select the **Conditional Access** tab to see which policies were evaluated and their result (Success, Failure, Not applied, or Report-only). 6. For failed sign-ins, check the **Basic info** tab for the error code (for example, 53003 = blocked by CA, 50074 = MFA required, 50158 = external security challenge). ### Part 2: Review configured CA policies 1. Go to **Identity** > **Protection** > **Conditional Access** > **Policies**. 2. Review the list. For each policy, check: - **State:** On, Off, or Report-only - **Users:** who is included and excluded - **Target resources:** which apps - **Conditions:** locations, device platforms, client apps, risk - **Grant controls:** Require MFA, compliant device, and so on 3. If the list is empty, the tenant is relying on **Security Defaults**. Check **Identity** > **Overview** > **Properties** > **Manage Security defaults**. ### Part 3: Use the What If tool 1. Go to **Identity** > **Protection** > **Conditional Access** > **Policies** > **What If**. 2. Enter a user, target app, and condition (IP, device state) to simulate which policies would apply. This is useful for validating coverage before a user reports an issue. ## Microsoft Graph API Combine two endpoints: `/auditLogs/signIns` for sign-in telemetry and `/identity/conditionalAccess/policies` for the policy inventory. ### 1. Fetch recent sign-ins with CA details ``` GET https://graph.microsoft.com/v1.0/auditLogs/signIns?$top=50&$orderby=createdDateTime desc ``` Filter to a time window and to failures only: ``` GET /v1.0/auditLogs/signIns?$filter=createdDateTime ge {start_iso} and status/errorCode ne 0&$top=100 ``` Filter for sign-ins where a CA policy failed: ``` GET /v1.0/auditLogs/signIns?$filter=conditionalAccessStatus eq 'failure'&$top=100 ``` ### Key response fields - `conditionalAccessStatus`: *success*, *failure*, *notApplied*, *unknownFutureValue* - `appliedConditionalAccessPolicies[]`: array of `{ id, displayName, enforcedGrantControls, enforcedSessionControls, result }` - `status.errorCode` and `status.failureReason`: sign-in error detail - `riskLevelDuringSignIn` and `riskState`: Identity Protection signals (P2) - `location`, `ipAddress`, and `deviceDetail`: context ### 2. Enumerate configured CA policies ``` GET https://graph.microsoft.com/v1.0/identity/conditionalAccess/policies?$select=id,displayName,state,conditions,grantControls,sessionControls ``` Example response (an empty list means only Security Defaults, or nothing): ``` {  "value": [    {      "id": "a1b2...",      "displayName": "Require MFA for admins",      "state": "enabled",      "grantControls": { "builtInControls": ["mfa"], "operator": "OR" }    }  ] } ``` ### 3. Check Security Defaults status ``` GET /v1.0/policies/identitySecurityDefaultsEnforcementPolicy ``` The response contains `isEnabled: true/false`. ### Required permissions (delegated or application) - `AuditLog.Read.All` - `Policy.Read.All` - `Directory.Read.All` ## PowerShell Use the `Microsoft.Graph` PowerShell module to pull sign-in logs, enumerate CA policies, and produce a consolidated report. ### Prerequisites ``` Install-Module Microsoft.Graph -Scope CurrentUser Connect-MgGraph -Scopes "AuditLog.Read.All","Policy.Read.All","Directory.Read.All" ``` ### Last 24 hours of sign-ins with CA status ``` $since = (Get-Date).AddDays(-1).ToString("yyyy-MM-ddTHH:mm:ssZ") Get-MgAuditLogSignIn -Filter "createdDateTime ge $since" -Top 200 |  Select-Object CreatedDateTime, UserPrincipalName, AppDisplayName, ConditionalAccessStatus, @{n='ErrorCode';e={$_.Status.ErrorCode}}, IpAddress |  Format-Table -AutoSize ``` ### Enumerate CA policies ``` Get-MgIdentityConditionalAccessPolicy |  Select-Object DisplayName, State, @{n='Grants';e={$_.GrantControls.BuiltInControls -join ','}} ``` ### Check Security Defaults ``` (Invoke-MgGraphRequest -Method GET -Uri "/v1.0/policies/identitySecurityDefaultsEnforcementPolicy").isEnabled ```