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
Log
Search for
AuditLogs, applications
Credentials, 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, permissions
Consents, 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 federation
Domains 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 Access
Exclusions 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 methods
Methods registered for users and method policy changes: Admin registered security info, User registered security info and Authentication Methods Policy Update
Temporary Access Pass
A user's current Temporary Access Pass: Get-MgUserAuthenticationTemporaryAccessPassMethod -UserId <upn>
AzureActivity, roles
Azure role assignments by the attacker's principals, under Microsoft.Authorization as roleAssignments/write
AzureActivity, managed identities
Federated credentials the attacker's principals added to user-assigned identities: Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials/write
App registrations now
Secret and certificate start dates on every app registration: az ad app list --all --query "[].{appId:appId, secrets:passwordCredentials[].startDateTime, certs:keyCredentials[].startDateTime}"
Service principals now
The same start dates on every service principal: az ad sp list --all --query "[].{appId:appId, secrets:passwordCredentials[].startDateTime, certs:keyCredentials[].startDateTime}"
Federated credentials now
The federated credentials on each app: az ad app federated-credential list --id <app-id>
SecurityAlert
Defender for Resource Manager persistence alerts: ARM_AnomalousOperation.Persistence and ARM_AnomalousServiceOperation.Persistence
Contain
#
Item
1
Export the Conditional Access policies first. The cmdlet needs the scope Policy.Read.All: Get-MgIdentityConditionalAccessPolicy -All
2
Export each federated domain's settings. The cmdlet needs the scope Domain-InternalFederation.Read.All: Get-MgDomainFederationConfiguration -DomainId <domain>
3
Export each suspect app's credentials and owners
4
Disable each backdoor service principal, keeping its credentials as evidence: Update-MgServicePrincipal -ServicePrincipalId <sp-object-id> -AccountEnabled:$false
5
Restore Conditional Access exclusions to baseline, starting with policies that require multifactor authentication (MFA)
6
Delete 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>
7
Remove owners the attacker added: az ad app owner remove --id <app-id> --owner-object-id <object-id>
8
Remove unknown federated credentials destructive, after recording: az ad app federated-credential delete --id <app-id> --federated-credential-id <id>
9
List the delegated permission grants in the tenant: Get-MgOauth2PermissionGrant -All
10
Remove the attacker's delegated grants destructive, after recording: Remove-MgOauth2PermissionGrant -OAuth2PermissionGrantId <id>
11
Convert a hijacked federated domain to managed destructive for federated sign-in: Update-MgDomain -DomainId <domain> -AuthenticationType "Managed"
12
Delete domains the attacker added destructive: Remove-MgDomain -DomainId <domain>
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.