An organization can enforce phishing-resistant MFA for its administrators and still overlook a different identity security risk: unauthorized credentials added to an existing application registration.

Unlike a human account, an application using client credentials does not complete an interactive MFA challenge. If an unauthorized credential is attached to an application that already has powerful permissions, the resulting access may persist independently of the human account involved in the original compromise.

The challenge for security teams is not simply detecting a new client secret. Credential rotation is a normal operational activity. The challenge is determining whether the change was authorized, what the application can access, and whether the credential was subsequently used.

This guide uses Microsoft Entra ID audit logs, service principal sign-in logs, and Kusto Query Language (KQL) to build a repeatable investigation workflow for suspicious application credentials.

Why Application Credentials Deserve Their Own Detection Strategy

An application registration defines an application's identity and configuration. A service principal represents that application within a particular tenant and can hold permissions to resources in that tenant. The application (client) ID, application object ID, and service principal object ID are different identifiers; confusing them can lead to incorrect investigation results.

Client secrets and certificates allow applications to authenticate without a user present. Depending on the permissions already granted, a compromised workload identity could expose Microsoft Graph data, Azure resources, or other protected APIs. Adding a credential does not itself grant new permissions, but it can provide another way to exercise existing access.

Microsoft recommends monitoring credential additions to existing applications as a high-priority security event. The most useful detection strategy combines configuration changes with authentication evidence and permission context rather than relying on any one signal.

Step 1: Verify Your Microsoft Entra ID Logging Coverage

In the Microsoft Entra admin center, open Monitoring & health and review Diagnostic settings. Configure the AuditLogs and ServicePrincipalSignInLogs categories to send data to an appropriate Log Analytics workspace. Verify licensing, retention, workspace access, and ingestion costs for your environment.

In Log Analytics, the relevant tables are AuditLogs and AADServicePrincipalSignInLogs. Run these two queries separately to confirm that recent records are arriving:

AuditLogs
| where TimeGenerated > ago(7d)
| summarize Events = count() by Category
AADServicePrincipalSignInLogs
| where TimeGenerated > ago(7d)
| summarize Events = count(), LastSeen = max(TimeGenerated)
    by ResultType

An empty result is not evidence that your tenant is secure. The relevant activity may not have occurred, logging may be disabled, or the records may be outside the retained time range. Diagnostic settings do not retroactively export historical events.

Step 2: Detect Application Credential Changes with KQL

The following query identifies successful credential-related operations over the previous seven days. It includes both application and service principal changes because the affected object can differ depending on how the change was performed.

AuditLogs
| where TimeGenerated > ago(7d)
| where Category =~ "ApplicationManagement"
| where Result =~ "success"
| where ActivityDisplayName in~ (
    "Update application - Certificates and secrets management",
    "Add service principal credentials"
)
| mv-expand Target = TargetResources
| extend TargetObjectId = tostring(Target.id),
         TargetName = tostring(Target.displayName),
         TargetType = tostring(Target.type),
         Actor = coalesce(
             tostring(InitiatedBy.user.userPrincipalName),
             tostring(InitiatedBy.app.displayName)),
         ActorAppId = tostring(InitiatedBy.app.appId),
         Changes = Target.modifiedProperties
| project TimeGenerated, ActivityDisplayName, Actor,
          ActorAppId, TargetName, TargetType,
          TargetObjectId, CorrelationId, Changes
| order by TimeGenerated desc

Review the initiator, target object, correlation ID, and modified properties. A certificate or secret management operation may reflect a removal, replacement, or other update rather than a new credential. Inspect the old and new values before classifying it as an addition. The audit log does not provide the usable secret value.

One administrative action may generate multiple audit events. Use correlation IDs and object identifiers to reconstruct the change rather than treating every returned row as a separate incident. Compare operation names against the current Microsoft audit activity reference and sample records from your own tenant; this query is intentionally not an exhaustive list of every credential management pathway, including federation.

Step 3: Investigate Service Principal Sign-ins

After identifying a suspicious change, resolve the application object to its local service principal using the Entra admin center or Microsoft Graph. Record the service principal object ID and, if available, the newly added credential's key ID from the audit details or application credential inventory.

The next query examines successful and unsuccessful authentication activity for that specific service principal. Replace the placeholder with the local service principal object ID.

let PrincipalId = "REPLACE-WITH-SERVICE-PRINCIPAL-OBJECT-ID";
AADServicePrincipalSignInLogs
| where TimeGenerated > ago(7d)
| where ServicePrincipalId =~ PrincipalId
| project TimeGenerated, ServicePrincipalName, AppId,
          ServicePrincipalId, ServicePrincipalCredentialKeyId,
          IPAddress, ResourceDisplayName, ResultType,
          ResultDescription
| order by TimeGenerated desc

Look for authentication from unfamiliar infrastructure, access to unexpected resources, or activity outside the application's normal operating schedule. Compare the sign-in credential key ID with the newly added key ID when both are available. This is stronger evidence than simply observing that an application authenticated after a change.

A successful token acquisition does not prove that a particular API operation or data access occurred. Investigate resource-side audit logs, such as Microsoft Graph activity logs where configured, to establish what the identity actually did.

Step 4: Find Newly Observed Credential Usage

A useful complementary detection is identifying credential key IDs that appear in recent successful service principal sign-ins but were not observed during an earlier baseline. This can help prioritize investigation even when the credential was created before the audit lookback period.

let RecentWindow = 1d;
let BaselineWindow = 30d;
let HistoricalKeys = AADServicePrincipalSignInLogs
| where TimeGenerated between (ago(BaselineWindow) .. ago(RecentWindow))
| where TimeGenerated < ago(RecentWindow)
| where ResultType in~ ("0", "Success")
| where isnotempty(ServicePrincipalId)
    and isnotempty(ServicePrincipalCredentialKeyId)
| distinct ServicePrincipalId, ServicePrincipalCredentialKeyId;
AADServicePrincipalSignInLogs
| where TimeGenerated >= ago(RecentWindow)
| where ResultType in~ ("0", "Success")
| where isnotempty(ServicePrincipalId)
    and isnotempty(ServicePrincipalCredentialKeyId)
| join kind=leftanti HistoricalKeys
    on ServicePrincipalId, ServicePrincipalCredentialKeyId
| summarize FirstObserved = min(TimeGenerated),
            LastObserved = max(TimeGenerated),
            SignInRecords = count(),
            IPs = make_set(IPAddress, 10),
            Resources = make_set(ResourceDisplayName, 10)
    by ServicePrincipalId, ServicePrincipalName,
       ServicePrincipalCredentialKeyId
| order by FirstObserved desc

The output identifies keys newly observed within the available telemetry, not necessarily newly created credentials. Routine rotations, new deployments, infrequently executed jobs, and incomplete retention can all produce legitimate findings. Verify the success-result values in your workspace before using this query in an alert rule.

This detection also excludes records without a populated credential key ID. Managed identities and federated workload credentials deserve separate monitoring strategies; do not treat this query as comprehensive workload identity coverage.

Step 5: Prioritize Findings Using Permission and Change Context

An unfamiliar credential on a low-impact test application and one on a production application with broad Graph access should not receive identical investigation priority.

Review the following factors together:

  • Change authorization: Is there an approved change ticket or documented rotation, and does the initiator match the expected operator or deployment identity?
  • Application permissions: Does the service principal hold sensitive application roles, Azure RBAC assignments, or directory roles? Review delegated grants separately from application permissions.
  • Credential evidence: Is the new key ID visible in subsequent authentication records? Was the credential used before its approved deployment window?
  • Infrastructure context: Are the source addresses and target resources consistent with the application's expected hosting and operating model?
  • Business criticality: Could disabling the identity interrupt production services, customer integrations, or automation pipelines?

A hypothetical example: a production reporting application receives a new credential outside its approved rotation window. Its sign-in logs later show the same key ID being used from unfamiliar infrastructure. If the application also holds broad data access permissions, the combined evidence warrants urgent review. None of these signals alone establishes malicious activity.

Step 6: Turn the Queries into an Operational Detection

For Microsoft Sentinel or Azure Monitor, begin with a scheduled credential-change rule using a lookback appropriate to the evaluation frequency and observed ingestion latency. For example, evaluate every 15 minutes over a 30-minute window after validating that your data arrives reliably. Group or deduplicate overlapping results to avoid repeated incidents.

Run the newly observed credential query as a daily hunting review initially. Build a baseline before promoting it to an automated alert. Maintain an inventory of approved rotation identities, expected applications, and change windows; avoid permanently excluding an entire privileged application simply because it rotates credentials regularly.

Validate both detections in a non-production application with an approved credential rotation. Confirm that the audit event arrives, that the expected service principal sign-in appears, and that the credential key can be correlated when populated. Record false positives and tune the rule before deploying broadly.

Responding to a Suspected Workload Identity Compromise

Preserve the audit and sign-in evidence, including object IDs, timestamps, key IDs, and correlation IDs. Confirm the application owner and review the initiator's recent activity. If the credential is unauthorized, coordinate with incident response and the application owner to remove or revoke it, rotate other potentially exposed credentials, and restrict or disable the service principal when the risk warrants it.

Removing a credential prevents future authentication using that credential but does not necessarily invalidate every previously issued access token immediately. Evaluate token lifetime, resource-specific containment options, and any downstream access. Review permissions and resource-side logs to determine impact, then verify that legitimate application workflows recover.

For prevention, prefer managed identities where supported, or workload identity federation for suitable external workloads. Where certificates or secrets remain necessary, enforce ownership, credential lifecycle controls, least privilege, and documented rotation. Strong user MFA is still essential, but it is not a substitute for workload identity governance.

Making Application Security Part of Your Entra ID Assessment

Application credentials are only one part of the identity attack surface. Privileged role changes, OAuth consent, application role assignments, risky user sign-ins, and service principal activity should be reviewed together to understand the potential scope of identity compromise.

The AzureWise Identity Security Assessment provides a deployable Azure Monitor Workbook and KQL query pack for reviewing Microsoft Entra ID security signals within your own Azure environment. The queries in this article are complementary hunting examples; validate and adapt them to your own telemetry before production use.

For a broader approach to identity risk prioritization, see How to Build a Custom Azure Risk Score for Your Tenant.

The key takeaway: do not stop at detecting a new application credential. Establish who changed it, what access the identity holds, whether the credential was used, and whether that activity matches the expected business workflow.

Microsoft Documentation and Further Reading

Put the guidance into practice

Want the Azure identity assessment already built?

AzureWise Identity Security Assessment turns Microsoft Entra ID telemetry into a weighted Security Rating, detailed findings, and prioritized remediation guidance inside Azure Monitor.

Get AzureWise — $99