How to Setup Conditional Access for Account Recovery

I recently wrote about the new Entra Account Recovery feature with Identity Verification and while the feature positive step for self-service recovery, it still lacked any enforcement with Conditional Access. This could have meant opening up a recovery flow that could create a backdoor for attackers. For example, if they can spoof the recovery process, they own the account.

Some great news is that Microsoft are soon to be rolling out Conditional Access support for Account Recovery, as per roadmap item 529855.

Why this is important

Previously, the account recovery process for if you had lost all authentication methods would be to call your helpdesk to resolve. Once Entra ID Account Recovery was added, you could then recover your account by completing a thorough identity verification with a trusted provider, albeit, the process could not be enforced. With this update, we can target the specific user action urn:user:accountrecovery within Conditional Access as well as the verifiedID control to partner with it.

Essentially, this will give administrators some control over what conditions must be met before a users is forced down the Account Recovery process using the new verified ID recovery process. Right now, its not clear exactly what conditions will be supported on release, but this could include conditions such as location, device compliance or platform, all would be useful.

Implementing the Policy

Implementing the policy is fairly simple, although is expected to only be possible from the rollout period which is around May 2026. That being said, some of the functionality is available in the Entra admin center. Just follow these steps:

  1. Log in to entra.microsoft.com
  2. Navigate to Entra ID > Conditional Access
  3. Select Create new policy from templates
  4. Type verified in the search bar and the Secure account recovery with identity verification (Preview) policy will appear. If you don’t search for the policy it will not appear.
  5. Select the policy and click Review + Create
Secure account recovery with identity verification (Preview)
Secure account recovery with identity verification (Preview)

Alternatively you can use the Invoke-MgGraphRequest cmdlet with Microsoft Graph PowerShell to deploy this policy using the code below:

$body = @{
    sessionControls = $null
    conditions = @{
        userRiskLevels = @()
        signInRiskLevels = @()
        clientAppTypes = @("all")
        servicePrincipalRiskLevels = @()
        agentIdRiskLevels = $null
        insiderRiskLevels = $null
        clients = $null
        platforms = $null
        locations = $null
        times = $null
        deviceStates = $null
        devices = $null
        clientApplications = $null
        authenticationFlows = $null
        applications = @{
            includeApplications = @()
            excludeApplications = @()
            includeUserActions = @("urn:user:accountrecovery")
            includeAuthenticationContextClassReferences = @()
            applicationFilter = $null
            networkAccess = $null
            globalSecureAccess = $null
        }
        users = @{
            includeUsers = @("All")
            excludeUsers = @()
            includeGroups = @()
            excludeGroups = @()
            includeRoles = @()
            excludeRoles = @()
            includeGuestsOrExternalUsers = $null
            excludeGuestsOrExternalUsers = @{
                guestOrExternalUserTypes = "b2bCollaborationGuest,b2bCollaborationMember,b2bDirectConnectUser,otherExternalUser,serviceProvider"
                externalTenants = @{
                    "@odata.type" = "#microsoft.graph.conditionalAccessAllExternalTenants"
                    membershipKind = "all"
                }
            }
        }
    }
    grantControls = @{
        operator = "AND"
        builtInControls = @("verifiedID")
        customAuthenticationFactors = @()
        termsOfUse = @()
        "[email protected]" = "https://graph.microsoft.com/beta/`$metadata#conditionalAccess/templates('6acdf4c3-6815-485c-a57d-2c349d517ba0')/details/grantControls/authenticationStrength/`$entity"
        authenticationStrength = $null
    }
    displayName = "Secure account recovery with identity verification (Preview)"
}

Invoke-MgGraphRequest -Method POST -Uri "https://graph.microsoft.com/beta/identity/conditionalAccess/policies" -Body $body

Breaking down the policy

The specific magic happens in the applications condition where we specify includeUserActions = @("urn:user:accountrecovery"). This tells Entra ID that this policy isn’t for a specific resource or context, but for the recovery action itself.

Then, look at the grantControls. We are setting builtInControls = @("verifiedID"). This effectively says “If you want to recover your account, you must present a Verified ID.” Hopefully that all makes sense!

Wrapping up

It’s annoying when security features are released without the controls to manage them properly, it seems that some of these features where rushed out for Microsoft Ignite (which happens every year), so some of the important stuff like Conditional Access support is missed, which isn’t acceptable. However, I’m glad Microsoft is catching up here fairly quickly.

Daniel Bradley

Daniel Bradley is a UK-based technical architect and Microsoft MVP in Security. He specialises in Microsoft Entra, Intune, and Microsoft Graph PowerShell and is the author of Microsoft Graph PowerShell for Administrators. He writes and edits Our Cloud Network using experience gained from working with Microsoft cloud environments.

Leave a Reply