A Microsoft Entra ID client secret is a password for an application, and whoever copies it can sign in as that application from anywhere, with every permission the app holds and no MFA to stop them. Client secrets are still the most common credential on app registrations because they are the easiest to create, and they end up in configuration files, pipeline variables and vendor platforms that hold access to your tenant. Microsoft's guidance is clear: do not use password secrets, prefer managed identities or workload identity federation, and use certificates where neither is possible. This guide covers how application credentials work in Entra ID, who can add them, how to restrict them with application management policies, how to detect misuse, and how to migrate away. It is for identity engineers, cloud platform teams and anyone reviewing Entra tenants. For consent, permissions and enterprise app governance, read the Entra ID Applications and Consent Guide; this page focuses on the credential itself.
This is an independent guide from NHI Mgmt Group, based on Microsoft's public 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
- Credential order of preference: managed identity, then workload identity federation, then a certificate, and a client secret only as a time-boxed exception.
- Anyone who can add a credential can become the app. App owners and the Application Administrator and Cloud Application Administrator roles can add secrets, so treat those assignments as privileged access.
- Application management policies enforce it. "Block password addition" and "Restrict max password lifetime" stop new secrets or cap their life tenant-wide, with named exclusions.
- Watch for new credentials on existing apps. Adding a secret to a privileged app (ATT&CK T1098.001 Additional Cloud Credentials) is a favourite persistence move and shows up in the audit log.
- Vendor-held secrets are your risk too. A secret a SaaS provider keeps for your tenant is a privileged NHI outside your control; limit its permissions and its sign-in locations.
How identity and access work in Entra application credentials
Every app registration (the application object) can hold two kinds of credential, and its service principal in each tenant can hold them too. The app uses the credential in the OAuth 2.0 client credentials flow to obtain tokens with its application permissions, or alongside a user in delegated flows.
| Credential | Stored as | Strength | Main risk |
|---|---|---|---|
| Client secret | passwordCredentials | Lowest assurance: a shared string sent to the token endpoint | Copied from config, logs, pipelines or vendor systems; usable anywhere |
| Certificate | keyCredentials (public key only) | Stronger: the private key never leaves the client, which signs an assertion | Private key exported from a file system or certificate store |
| Federated identity credential | Trust in an external issuer and subject | No stored secret; short-lived external token exchanged | Over-broad subject claims or untrusted issuers |
| Managed identity | Azure-managed, no credential exposed | Strongest for workloads in Azure | Over-permissioned identity on a compromised resource |
- Secret format: current Entra secrets contain the sequence
Q~after the first four characters, which is how scanners such as the Gitleaksazure-ad-client-secretrule find them. - Shown once: the secret value is displayed only when created. Teams that lose it create another rather than removing the old one, which is how apps accumulate several live secrets.
- Lifetime: the portal offers preset expiry periods up to 24 months; longer lifetimes can be set through Microsoft Graph or PowerShell unless a policy stops it.
- Two places to look: credentials can sit on the application object or directly on the service principal (common for SAML apps and some multi-tenant scenarios). Inventory both.
Admin roles and privileged access
The question that matters is who can add a credential to an app that holds powerful permissions. If a helpdesk-level role can add a secret to an app with Mail.Read application permission across the tenant, that role effectively has that permission.
| Who | Can manage credentials on | Control |
|---|---|---|
| Application owner | Apps they own | Keep owners minimal and review them every few months, as Microsoft advises; avoid owners on high-privilege apps |
| Application Administrator, Cloud Application Administrator | All app registrations and enterprise apps | Treat as Tier 0 for tenants with privileged apps; assign through PIM with approval |
| Global Administrator | Everything | Break-glass and a very small named group only |
| Custom role limited to credential rotation | Scoped apps | Microsoft suggests a least-privileged custom role that can only rotate application credentials for automation |
Configuring application management policies requires Security Administrator plus Cloud Application Administrator or Application Administrator, or Global Administrator. Caller exclusions use custom security attributes, so they also involve the Attribute Definition Administrator and Attribute Assignment Administrator roles. See the Azure RBAC and Service Principals Guide for the Azure resource side of the same identities.
Integrations, API tokens and service accounts
Choosing the credential
| Where the workload runs | Use | Notes |
|---|---|---|
| Azure (App Service, Functions, VMs, AKS) | Managed identity | No credential to rotate or leak. See the Azure Managed Identities Security Guide |
| GitHub Actions, other clouds, Kubernetes | Federated identity credential | Configure only trusted issuers and exact subjects. See the Workload Identity Federation Guide |
| On-premises service or server | Certificate from a trusted CA, private key non-exportable | Store in Azure Key Vault or a hardware-backed store; enforce trusted issuers by policy |
| Third-party SaaS integration in your tenant | Vendor's multi-tenant app with consent, not a secret you create and hand over | The vendor holds its own credential; you control consent and permissions |
| Legacy app that only supports secrets | Client secret, short lifetime, in Key Vault | Documented exception with an owner and a migration date |
Vendor-held credentials
Backup, security and migration tools often hold an Entra app credential with broad application permissions across customer tenants. Ask each vendor which credential type it uses, how it rotates it, and whether you can restrict sign-ins to its IP ranges. With Workload Identities Premium, Conditional Access for workload identities can block a service principal from outside known IP ranges or when Entra ID Protection flags it as risky.
Rotation that does not cause outages
- Add the new certificate or secret alongside the old one (an app can hold several).
- Update the consumer from Key Vault and confirm successful sign-ins with the new credential in the service principal sign-in log.
- Remove the old credential with
removePasswordorremoveKey, never just let it expire. - Keep the old credential's key ID in the change record so you can tell from logs if anything still tries it.
Logging and detection
| Source | What to watch | Why |
|---|---|---|
| Entra audit log, "Update application" with Certificates and secrets management changes, and service principal updates | New secrets or certificates on existing apps, especially privileged or long-dormant ones | T1098.001 Additional Cloud Credentials persistence |
| Service principal sign-in log | Sign-ins from new IP addresses, countries or hosting providers; failures with old key IDs | Use of a stolen secret, which blends in as legitimate traffic |
| Usage and insights: Application credential activity | Credentials that are active, expiring or unused | Inventory and hygiene |
Entra recommendations: Remove unused credentials from applications (staleAppCreds) | Credentials unused for 30 days | Dead credentials that still work are pure risk |
| Microsoft Graph activity logs and workload logs | Unusual Graph calls by an app, such as bulk mailbox or file reads | Impact of a compromised app identity (T1550.001) |
| Secret scanning with push protection in repositories | Q~ pattern hits | Leak before use |
Credentials added by an attacker to an old, forgotten app are particularly hard to spot. Include legacy and test apps in every credential review.
Responding to a leaked or misused secret
- Identify the app: match the secret's key ID or hint (the first characters shown in the portal) to the application and the tenant it works in, and list its application permissions.
- Remove the credential: delete the leaked secret immediately. Removing it stops new token requests, but access tokens already issued remain valid until they expire, typically within about an hour.
- Look for persistence: check the audit log for other credentials, owners, federated credentials or permissions added to this or other apps since the leak, and remove anything unexplained.
- Scope the access: review service principal sign-ins and Microsoft Graph activity for the app over the exposure window, and treat any data the permissions reach as potentially accessed.
- Re-issue safely: replace the secret with a certificate or federated credential where possible, rather than another secret.
- Fix the source: clean the repository history, pipeline variable or configuration store, and confirm push protection now catches the pattern. See the Git Secret Scanning Guide.
Metrics
- Secret share: percentage of app registrations and service principals with at least one password credential.
- Long-lived secrets: secrets with a lifetime above your policy maximum (target zero after migration).
- Stale credentials: open
staleAppCredsitems. - Unexpected additions: credentials added outside the change process per month, each investigated.
- Privileged apps on secrets: apps holding high-impact application permissions that still use secrets.
- Owner hygiene: apps with no owner, or with owners who have left.
Hardening baseline
Application management policies are the enforcement mechanism. Each restriction can apply to all applications, to all with exclusions (named apps or named callers), or to selected applications.
| Restriction (portal name) | Graph restriction | Suggested setting |
|---|---|---|
| Block password addition | passwordAddition, symmetricKeyAddition | On for all applications, with dated exclusions for legacy apps |
| Restrict max password lifetime | passwordLifetime, symmetricKeyLifetime | For excluded apps, a short maximum such as 90 to 180 days |
| Block custom passwords | customPasswordAddition | On: secrets must be generated by Entra |
| Restrict max certificate lifetime | asymmetricKeyLifetime | Align with your PKI policy, for example one year |
| Trusted certificate authority (Graph only) | trustedCertificateAuthority | Allow only your enterprise or chosen public CAs |
| Audiences and identifier URIs | audiences, nonDefaultUriAddition | Restrict multi-tenant and consumer apps unless needed |
Application authentication method policies need Premium licensing. Note that the admin center creates custom policies to implement exclusions, and those are visible only through Microsoft Graph, so audit them there.
Rollout
- Inventory: export every application and service principal with its
passwordCredentialsandkeyCredentials, end dates, owners and application permissions. - Clean up: remove expired and unused credentials first; it is risk-free and shrinks the problem.
- Prioritise: migrate apps with high-impact permissions (mail, files, directory write, RoleManagement) to managed identities, federation or certificates.
- Pilot the policy: apply "Block password addition" to selected applications, then all applications with exclusions, watching for broken deployment pipelines that create secrets.
- Restrict roles: move Application Administrator and Cloud Application Administrator to PIM, and remove owners from privileged apps.
- Monitor: deploy the audit and sign-in alerts above before the policy goes tenant-wide.
Rollback: policy changes apply to new credentials, not existing ones, so a broken pipeline is fixed by adding its caller or app as an exclusion, not by switching the policy off.
Decision guidance
- Small tenant: remove unused secrets, put the rest in Key Vault with 180-day lifetimes, block new secrets and review monthly.
- Large tenant: enforce trusted CAs and certificate lifetimes, automate rotation through a credential-only custom role, add Conditional Access for workload identities for privileged apps, and include app credentials in access reviews.
- Certificate or federation: federate whenever the workload has an issuer Entra can trust; a certificate still has a private key to protect and renew.
Common misconfigurations
- Two-year secrets on privileged apps. Long lifetimes mean a leaked secret stays valid long after anyone remembers where it went.
- Several live secrets per app. Lost values get replaced, not removed, and old copies keep working.
- Secrets on public client apps. Microsoft advises that mobile and desktop apps have no credentials on the application object.
- Broad app admin roles assigned permanently. A compromised Application Administrator can add a secret to any app and inherit its permissions.
- Forgotten test and legacy apps with powerful permissions and no owner.
- No sign-in restrictions on vendor apps holding tenant-wide permissions; restrict them to known IP ranges where licensing allows.
Framework mapping
| Control | NIST CSF 2.0 | NIST SP 800-53 Rev. 5 | ATT&CK |
|---|---|---|---|
| App credential inventory and lifecycle | PR.AA-01 | AC-2, IA-5 | T1552.001 Credentials In Files |
| Certificates and federation over secrets | PR.AA-02 | IA-5(2), IA-9 | T1078.004 Cloud Accounts |
| Least privilege for apps and app admins | PR.AA-05 | AC-6 | T1098.001 Additional Cloud Credentials |
| Audit and sign-in monitoring | DE.CM-03 | AU-6, AU-12 | T1550.001 Application Access Token |
Practitioner checklist
- Export all app registrations and service principals with credentials, end dates, owners and permissions.
- Remove expired, unused and duplicate credentials.
- Migrate workloads to managed identities or federated credentials; use certificates where neither fits.
- Enable "Block password addition" and "Block custom passwords", with dated exclusions.
- Cap secret and certificate lifetimes and enforce trusted certificate authorities through Graph.
- Put Application Administrator and Cloud Application Administrator behind PIM and minimise app owners.
- Alert on credentials added to existing apps and on service principal sign-ins from new locations.
- Restrict privileged and vendor service principals with Conditional Access for workload identities where licensed.
- Store remaining secrets in Key Vault and rotate by add, switch, verify, remove.
- Scan repositories and pipelines for the
Q~secret pattern with push protection on.
Standards and references
- Microsoft Learn: Security best practices for application properties
- Microsoft Learn: Migrate applications away from secret-based authentication
- Microsoft Learn: Configure application management policies
- Microsoft Learn: Add and manage application credentials
- Microsoft Learn: Remove unused credentials from applications
- Microsoft Learn: Service principal sign-in logs
- MITRE ATT&CK: Additional Cloud Credentials
- NIST: SP 800-53 Rev. 5
Related NHI Mgmt Group resources: Entra ID Applications and Consent Guide · Entra ID Security Guide · Azure Key Vault Security Guide · SaaS and OAuth App Governance Guide · Secrets Management Guide