PIVTR-D
RAzure playbook · Identity and access

Backdoor apps, credentials and federation

An attacker with an admin or app owner foothold adds a secret, certificate or federated identity credential to an application, or grants it permissions. Other routes federate a domain to the attacker's own identity provider, exclude an account from Conditional Access, or issue a Temporary Access Pass. Each keeps access open after you reset the first compromised account, so export the current state first and then remove every path.

Look here

LogSearch for
AuditLogs, applicationsCredentials, owners and new apps. A federated credential added to an app logs as Update application, so check TargetResources for the changed property. Match the secrets activity with has: Add service principal credentials, Certificates and secrets management, Add owner to application, Add owner to service principal and Add application
AuditLogs, permissionsConsents, delegated grants, admin roles and authorization policy changes: Consent to application, Add delegated permission grant, Add member to role, Update authorization policy and Add app role assignment to service principal
AuditLogs, domains and federationDomains added, verified or federated: AuditLogs | where ActivityDisplayName has_any ("Set federation settings on domain", "Set domain authentication", "Add unverified domain", "Verify domain") | project TimeGenerated, ActivityDisplayName, InitiatedBy, TargetResources
AuditLogs, Conditional AccessExclusions and locations changed. Compare exclusions with your baseline: Update Conditional Access policy, Delete Conditional Access policy, Update named location and Update security defaults
AuditLogs, authentication methodsMethods registered for users and method policy changes: Admin registered security info, User registered security info and Authentication Methods Policy Update
Temporary Access PassA user's current Temporary Access Pass: Get-MgUserAuthenticationTemporaryAccessPassMethod -UserId <upn>
AzureActivity, rolesAzure role assignments by the attacker's principals, under Microsoft.Authorization as roleAssignments/write
AzureActivity, managed identitiesFederated credentials the attacker's principals added to user-assigned identities: Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials/write
App registrations nowSecret and certificate start dates on every app registration: az ad app list --all --query "[].{appId:appId, secrets:passwordCredentials[].startDateTime, certs:keyCredentials[].startDateTime}"
Service principals nowThe same start dates on every service principal: az ad sp list --all --query "[].{appId:appId, secrets:passwordCredentials[].startDateTime, certs:keyCredentials[].startDateTime}"
Federated credentials nowThe federated credentials on each app: az ad app federated-credential list --id <app-id>
SecurityAlertDefender for Resource Manager persistence alerts: ARM_AnomalousOperation.Persistence and ARM_AnomalousServiceOperation.Persistence

Contain

#Item
1Export the Conditional Access policies first. The cmdlet needs the scope Policy.Read.All: Get-MgIdentityConditionalAccessPolicy -All
2Export each federated domain's settings. The cmdlet needs the scope Domain-InternalFederation.Read.All: Get-MgDomainFederationConfiguration -DomainId <domain>
3Export each suspect app's credentials and owners
4Disable each backdoor service principal, keeping its credentials as evidence: Update-MgServicePrincipal -ServicePrincipalId <sp-object-id> -AccountEnabled:$false
5Restore Conditional Access exclusions to baseline, starting with policies that require multifactor authentication (MFA)
6Delete an attacker's Temporary Access Pass destructive, then revoke the user's sessions. This needs Authentication Administrator or Privileged Authentication Administrator: Remove-MgUserAuthenticationTemporaryAccessPassMethod -UserId <upn> -TemporaryAccessPassAuthenticationMethodId <id>
7Remove owners the attacker added: az ad app owner remove --id <app-id> --owner-object-id <object-id>
8Remove unknown federated credentials destructive, after recording: az ad app federated-credential delete --id <app-id> --federated-credential-id <id>
9List the delegated permission grants in the tenant: Get-MgOauth2PermissionGrant -All
10Remove the attacker's delegated grants destructive, after recording: Remove-MgOauth2PermissionGrant -OAuth2PermissionGrantId <id>
11Convert a hijacked federated domain to managed destructive for federated sign-in: Update-MgDomain -DomainId <domain> -AuthenticationType "Managed"
12Delete domains the attacker added destructive: Remove-MgDomain -DomainId <domain>

Eradicate and recover

#Item
1Clean every credential that started in the window with the service principal playbook
2List federated credentials on every user-assigned identity: az identity federated-credential list --identity-name <identity> --resource-group <rg>
3Delete applications the attacker created. A deleted application stays restorable for 30 days: az ad app delete --id <app-id>
4Set federatedIdpMfaBehavior to rejectMfaByFederatedIdp on domains that must stay federated
5Restrict app registration and user consent in the authorization policy
6If a Global Administrator made these changes, continue with the tenant compromise playbook
Watch out
  • A federated identity credential contains no secret. Sweeps of passwordCredentials and keyCredentials miss it, so list federated credentials on every app and user-assigned identity.
  • A federated domain lets its identity provider sign tokens for every user in that domain. Password resets and MFA changes leave that path open until you fix the federation settings.
  • Converting a domain to managed stops sign-in for its users unless password hash sync or pass-through authentication is ready.
  • Expiry of a Temporary Access Pass leaves sessions established with it in place, and they can outlive the pass under your Conditional Access session settings. Revoke the user's sessions after you delete the pass.

Microsoft Learn: Entra audit log activity reference; monitor federation configuration changes; migrate from federation to cloud authentication; manage custom domain names; Temporary Access Pass; restore an application; Graph permissions for conditionalAccessPolicies and internalDomainFederations; Microsoft Graph PowerShell reference for the cmdlets used; Azure CLI reference for az ad app and az identity. Checked October 2026. Defender for Cloud Resource Manager alerts: checked October 2026.

Adapts material from Dynamic Incident Response: A Framework for Security Teams by Joshua Wright, © 2026 The Escal Institute of Advanced Technologies, Inc. d/b/a SANS Institute, licensed under CC BY 4.0. Figures reproduced under that license. Changes were made. Not published by, endorsed by, or affiliated with the SANS Institute.