Join our Newsletter — 33% off our NHI Course
Home› Guides› How to Investigate and Remediate a Risky Service…
Guide Cloud & Workload Identity

How to Investigate and Remediate a Risky Service Principal in Entra: Triage, Containment and Hardening Steps

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 27 November 2026 14 min read
On this page

A service principal flagged as risky in Microsoft Entra is an unattended identity that may already be in an attacker's hands, and nobody gets an MFA prompt to warn them. Service principals authenticate with secrets, certificates or federated credentials, often hold application permissions across Microsoft Graph or Azure subscriptions, and rarely have an owner watching their sign-ins. This guide walks an identity security analyst or Entra administrator through one incident: confirming the risk signal, reviewing credentials and permissions, reading the sign-in and audit trail, containing the identity with a clear view of business impact, and hardening it so the same path cannot be reused. For how service principals relate to app registrations and Azure RBAC, see the Azure RBAC and Service Principals Guide; this page does not repeat it.

This is an independent guide from NHI Mgmt Group, based on Microsoft's public Entra documentation as of November 2026. It is not sponsored or reviewed by Microsoft. Product features change, so confirm settings against Microsoft's current documentation.

Key takeaways

  • Treat the risk flag as a lead, not a verdict. All workload identity detections are offline, so the compromise may be hours old by the time you see it; work back from the detection timestamp.
  • Check both objects. Credentials can sit on the application object and on the service principal object; an attacker who adds a secret to either has a working key.
  • Disable before you delete. Setting the service principal to disabled stops new token issuance and buys time to assess impact; deletion and key rolling come after.
  • Revocation is more than one step. Removing credentials, revoking consent grants and app role assignments, and rotating secrets the identity could read are separate actions, and skipping any one leaves a path open.
  • Fix the root cause. Containment does not explain how the attacker got in; find whether a compromised admin, a leaked secret or a consent grant created the access before closing the case.

What makes a service principal risky

Microsoft Entra ID Protection evaluates service principals separately from users. A risky workload identity appears under ID Protection > Risky workload identities, and individual detections appear on the Workload identity detections tab of the Risk detections report. Microsoft documents every current workload identity detection as offline (calculated after the event), which matters for timeline work.

DetectionriskEventTypeWhat it indicatesFirst question to ask
Leaked credentialsleakedCredentialsA valid credential for the identity was found in a public code artefact or a data breachWhich credential (key ID) leaked, and has it been used since?
Suspicious sign-inssuspiciousSigninsSign-in properties unusual for this identity: IP or ASN, target resource, user agent, hosting versus non-hosting IP, country, credential typeDid an approved change (new region, new pipeline runner) cause it?
Anomalous service principal activityanomalousServicePrincipalActivityUnusual administrative changes to the directory made by, or made to, the service principalWhat objects changed, and who approved it?
Suspicious API trafficsuspiciousAPITrafficAbnormal Microsoft Graph traffic or directory enumerationWhat data could the identity read with its current permissions?
Microsoft Entra threat intelligenceinvestigationsThreatIntelligenceActivity consistent with known attack patternsIs the same infrastructure seen against other identities in the tenant?
Suspicious applicationsuspiciousApplicationThe app may violate terms of service but has not been disabled by MicrosoftIs this a multitenant app you consented to, and who uses it?
Malicious applicationmaliciousApplicationMicrosoft disabled the app for a terms of service violationWhich users and data did it touch before it was disabled?
Admin confirmed service principal compromisedadminConfirmedServicePrincipalCompromisedAn administrator selected Confirm compromisedWhich admin, and was the case already opened?

Risk is not the only trigger. Treat these signals as equivalent leads even when ID Protection is quiet: a new secret or certificate added outside change management, a new owner on the application, a new high-privilege app role assignment such as Directory.ReadWrite.All or Mail.* on Microsoft Graph, and sign-ins from an IP range the workload has never used.

Coverage: detections cover single-tenant apps, multitenant apps and non-Microsoft SaaS apps in your tenant. Managed identities are not currently in scope for workload identity risk detections, so a suspicious managed identity is investigated from logs and Azure RBAC alone.

Availability: Microsoft states that all tenants receive the detections, while full risk details and risk-based Conditional Access for workload identities need Microsoft Entra Workload ID Premium. Viewing the reports needs at least Security Reader; the compromised application playbook expects investigators to hold Security Administrator; creating Conditional Access policies needs Conditional Access Administrator; revoking app permissions needs Cloud Application Administrator or Application Administrator.

Triage: confirm the signal

Aim to reach a decision (benign, suspicious, confirmed compromised) within the first hour. Work through these steps in order:

  1. Record the facts: service principal object ID (from Enterprise applications, not App registrations), application (client) ID, detection type, risk level, detection timestamp and risk state.
  2. Identify the type: single-tenant (you own the code and credentials), multitenant from a vendor (the vendor owns credentials; you own the consent), or a Microsoft first-party app.
  3. Find the owner: list owners on the application object and in Enterprise applications. Contact them to confirm whether any recent credential, location or permission change was planned.
  4. Check for planned change: match the detection against change tickets and deployment logs. Suspicious sign-ins can fire after an authorised move to a new hosting provider or region; Microsoft notes that baselines take between 2 and 60 days to learn.
  5. Size the blast radius: list Graph application permissions, delegated grants, Entra directory roles and Azure RBAC role assignments held by the identity.
  6. Decide: if the change is explained and documented, dismiss the risk with a note. If any credential, permission or sign-in is unexplained, move to containment in parallel with the deeper review below.

Review credentials, permissions and owners

Inventory everything that lets the identity authenticate or act. The table lists where each item lives and the audit activity that records a change, using the activity names in Microsoft's documentation.

ItemWhere to lookAudit activity to searchRed flag
Client secrets and certificatespasswordCredentials and keyCredentials on the application object and on the service principal objectUpdate application - Certificates and secrets management; Update Service principalA credential added recently, outside working hours, or with a lifetime beyond policy; any password credential on a service principal object
Federated identity credentialsCertificates and secrets > Federated credentials on the app registrationUpdate application (check modified properties)An issuer or subject you do not recognise, such as an unknown repository or Kubernetes cluster
Microsoft Graph and API application permissionsEnterprise application > Permissions > Admin consent; appRoleAssignmentsAdd app role assignment to service principalHigh-privilege roles such as *.All, Directory.ReadWrite.All, RoleManagement.ReadWrite.Directory or Mail.*
Delegated grantsoauth2PermissionGrants for the service principalAdd delegated permission grant; Consent to applicationConsentType of AllPrincipals with sensitive scopes; consent by a privileged user
Entra directory rolesRoles and administrators, filtered to service principalsAdd member to role; Add eligible member to role; Add scoped member to roleAny privileged role assigned outside change management
Azure RBAC rolesAccess control (IAM) at management group, subscription and resource group scopeAzure Activity log: role assignment write operationsOwner, Contributor or User Access Administrator at broad scope
OwnersOwners on the application and the enterprise applicationAdd owner to applicationA user added as owner who can now add credentials without an admin role

Record each credential's keyId, display name, start and end date. The key ID is how you link a credential to the sign-ins it produced. For a structured review of federated trust relationships, see How to audit Entra workload identity federated credentials. For finding long-lived or forgotten secrets across the tenant once the incident is closed, see How to find expiring app secrets and certificates in Entra ID.

Analyse sign-ins and activity

For detection rule design on these logs, see the Entra ID Audit Log Detection Guide.

Entra keeps four sign-in log types: interactive user, non-interactive user, service principal and managed identity. A service principal authenticating with its own secret or certificate appears only in Service principal sign-ins; managed identity sign-ins appear only in the managed identity log. Reading these logs in the admin center needs at least Reports Reader. For investigations longer than the portal retention window, send sign-in and audit categories to a Log Analytics workspace through diagnostic settings, where they land in the AADServicePrincipalSignInLogs, AADManagedIdentitySignInLogs and AuditLogs tables.

Build the timeline around four questions Microsoft gives for workload identity investigations: suspicious sign-in activity, unauthorised credential changes, suspicious configuration changes, and unauthorised application roles.

  • Sign-in baseline: compare the last 30 days of IP addresses, ASNs, countries and target resources with the period before the detection.
  • Credential to sign-in link: check which credential key ID each sign-in used. Sign-ins using a credential added during the suspicious window are strong evidence of attacker use.
  • Resource activity: follow the identity into the resources it reached. For Graph, review mailbox, file and directory reads where audit data exists; for Azure, review the Activity log for writes made by the service principal's object ID, especially role assignments, Key Vault secret reads and new resources.
  • Changes the identity made: search AuditLogs where the initiating actor is the service principal. A compromised identity holding Application.ReadWrite.All can add credentials to other applications, which turns one incident into several.
  • Who changed the identity: search AuditLogs where the target is the application or service principal. If an admin account added the credential, that account is in scope too: see How to Investigate a Compromised Entra ID Account.

Contain and remediate

Containment actions differ in speed, reversibility and impact. Choose by the identity's privilege and the confidence of the finding, and coordinate with the application owner so that a production outage is a decision, not a surprise.

ActionHowEffectImpact and caveats
Disable the service principalEnterprise application > Properties > Enabled for users to sign in = No, or set accountEnabled to false through Microsoft Graph; also available from the Risky workload identities reportBlocks new token issuance for the identityBreaks every process using it; fully reversible; tokens already issued remain valid until they expire
Confirm compromisedRisky workload identities > Confirm compromisedRaises risk to high and feeds risk-based Conditional AccessRecorded in risk history with the confirming admin
Remove credentialsremovePassword and removeKey on the application and on each service principal, after adding a replacementInvalidates leaked or attacker-added keysMicrosoft advises removing all existing credentials if the account is at risk; workloads fail until they hold the new credential
Revoke app permissionsEnterprise application > Permissions > Revoke permission (admin consent); Graph or PowerShell to remove oauth2PermissionGrants and appRoleAssignmentsStops new tokens carrying those permissionsUser consent grants cannot be revoked in the portal; users can consent again unless consent settings are restricted; revoked permissions can be restored
Rotate reachable secretsRotate Key Vault secrets, keys and certificates the identity could read, starting with those it actually readCloses the second-stage exposureOften the slowest step; prioritise secrets confirmed read in Key Vault logs
Delete the applicationDelete the app registration or enterprise applicationRemoves the identitySoft-deleted apps can be restored for 30 days; monitor for "Add Service Principal" and for "Update Service Principal" re-enabling the account

A safe order for a confirmed compromise of a single-tenant identity:

  1. Disable the service principal and confirm compromised. If an admin account may also be compromised, time this with the admin eviction so the attacker loses every route at once.
  2. Remove attacker-added credentials, roles, grants, owners and federated credentials found in the review.
  3. Add a new certificate credential (Microsoft recommends X.509 certificates), deploy it to the legitimate workload, then remove all remaining old credentials. The Entra secret rotation guide covers overlap rotation.
  4. Rotate Key Vault and other secrets the identity could reach.
  5. Re-enable the service principal only after the owner confirms the workload uses the new credential and the permissions match its documented need.
  6. For a multitenant vendor app, you cannot rotate the vendor's credentials: revoke consent, disable the enterprise application in your tenant, and contact the vendor. Apps that Microsoft disabled for a terms of service violation show DisabledDueToViolationOfServicesAgreement and cannot be deleted, which stops them being re-created in your tenant.

Credential removal cannot be rolled back, which is why the replacement goes in first. Preserve evidence before you remove anything: export the application manifest, owners, credentials list (key IDs, not secret values), permission grants, role assignments and the relevant sign-in and audit rows.

Harden to prevent recurrence

  • Replace secrets where possible: move Azure-hosted workloads to managed identities so there is no credential to leak, and external workloads such as CI pipelines to workload identity federation. See the Azure Managed Identities Security Guide.
  • Use certificates over client secrets: where a credential must exist, prefer an X.509 certificate held in a hardware-backed or managed store, with a short lifetime and an owner who receives expiry alerts. The Azure Entra Client Secrets Security Guide covers credential policy.
  • Apply Conditional Access for workload identities: block single-tenant service principals from outside named locations and block them at medium or high service principal risk. Policies must target the service principal directly (group targeting is not enforced), target All resources, and support Block only. Start in report-only mode and review the Service principal sign-ins Conditional Access tab before enforcing. See Conditional Access for Workload Identities.
  • Restrict consent: limit user consent, enable the admin consent workflow and keep risk-based step-up consent on. See How to restrict user consent to apps in Entra ID.
  • Alert on the change, not only on risk: create detections for credential additions, owner additions and privileged app role assignments, since these precede most service principal abuse and work for managed identities and unlicensed tenants too.

Detection, framework mapping and metrics

FrameworkReferenceRelevance
MITRE ATT&CKT1098.001 Additional Cloud CredentialsAttacker adds a secret or certificate to an application or service principal
MITRE ATT&CKT1098.003 Additional Cloud RolesAttacker grants new directory roles or app role assignments
MITRE ATT&CKT1078.004 Cloud AccountsUse of a valid service principal credential
NIST SP 800-53 Rev 5IR-4, IA-5, AC-2, AC-6, AU-6Incident handling, authenticator management, account management, least privilege, log review
NIST CSF 2.0RS.MI-01, PR.AA-05Incidents are contained; access permissions are managed and reviewed

Metrics that show the process is working:

  • Time to triage: median time from detection timestamp to a benign or compromised decision.
  • Time to contain: median time from decision to service principal disabled or credentials removed.
  • Unowned risky identities: share of risky service principals with no reachable owner at the time of detection (target zero).
  • Secret-based identities: share of service principals still authenticating with client secrets, tracked down over time.
  • Conditional Access coverage: share of single-tenant service principals covered by a location or risk policy.

Common failure patterns

  • Rotating only the application object: the team removes secrets on the app registration but misses a password credential added directly to the service principal, which keeps working.
  • Revoking consent but leaving consent open: grants are removed, user consent settings stay permissive, and the same app is consented to again days later.
  • Ignoring the second stage: the identity is cleaned up but the Key Vault secrets and storage keys it read are not rotated, so the attacker keeps access through other credentials.
  • Stopping at the identity: the admin account or consent grant that created the access is never investigated, and the attacker creates a new service principal.

Practitioner checklist

  • Inventory secrets, certificates and federated credentials on both the application and service principal objects, with key IDs.
  • List Graph permissions, delegated grants, directory roles and Azure RBAC assignments, and flag any added in the incident window.
  • Correlate service principal sign-ins by credential key ID, IP, ASN and resource against a pre-incident baseline.
  • Search audit logs for changes made by and to the identity, and widen scope to any admin who made them.
  • Export evidence, then disable the service principal and confirm compromised.
  • Add a certificate credential, deploy it, then remove all old credentials; revoke unneeded grants and roles.
  • Rotate Key Vault and other secrets the identity could read.
  • Apply Conditional Access for workload identities, restrict consent and move the workload to a managed identity or federation where possible.

Standards and references

Related NHI Mgmt Group resources: Azure RBAC and Service Principals Guide · Microsoft Entra ID Protection · Entra ID Applications and Consent Guide · Cloud Workload Identity Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.