Most Azure data services still accept a static key or connection string next to Microsoft Entra ID, and every one of those keys is an unowned, non-expiring credential that bypasses role-based access control. Each service has its own switch to turn local authentication off, usually a property called disableLocalAuth, and Azure Policy has matching built-in definitions to audit, deny or fix it. This guide treats the job as one tenant-wide programme rather than a service-by-service clean-up: inventory every resource that still accepts keys, find the callers, move them to managed identities or service principals with data roles, then switch keys off and keep them off with policy. It is for Azure platform, cloud security and identity teams. Storage accounts are covered step by step in How to rotate Azure storage account keys and move to disabled Shared Key access, so this page links to it rather than repeating it.
Local authentication here means any data-plane credential that is not an Entra token: account keys, shared access signature (SAS) rules, access keys, API keys, admin users and connection strings built from them. A key is a non-human identity with no owner, no sign-in log entry under a named principal, and no Conditional Access. Removing the class of credential is stronger than rotating it.
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
- One concept, many switches. Service Bus, Event Hubs, Event Grid, Cosmos DB, App Configuration, Application Insights and Azure AI services each expose their own local authentication setting, and Storage, Redis, AI Search and Container Registry use different names for the same idea.
- Find callers before you flip anything. Use each service's own evidence (runtime logs, connection metrics, transaction metrics) to prove no client still sends a key, then disable per environment, development first.
- Effects differ by service. App Configuration deletes its keys, Redis drops every connection, and Azure AI services can keep honouring old keys for minutes to hours while its gateway cache refreshes.
- Policy keeps the door shut. Assign the built-in "should have local authentication methods disabled" definitions in Audit first, then Deny for new resources, and use the "Configure ... to disable local authentication" Modify definitions with remediation tasks for estates you trust.
- Control-plane roles still read keys. While keys are on, Owner and Contributor can call listKeys and reach all data, so disabling local authentication also shrinks the blast radius of broad Azure roles.
Why local keys are an identity problem
Entra ID authentication gives every caller a named principal, a token with a lifetime, a role assignment at a chosen scope and a sign-in record. A local key gives none of that. Microsoft's App Configuration documentation notes that Owner and Contributor do not grant Entra data access but do include listKeys/action, which gives access to all data through the access keys. The same pattern applies across services: whoever can list keys on the control plane effectively holds data access, whatever the data-plane role design says. Microsoft's Azure AI services guidance makes the point directly for that service: key-based authentication grants access without role restrictions.
Keys also leak in predictable places: application settings, pipeline variables, local configuration files and copied connection strings in tickets. That is ATT&CK T1552.001 Credentials In Files, and the wider pattern is covered in the MITRE ATT&CK T1552 Unsecured Credentials Guide. Turning local authentication off makes a leaked key useless instead of something you have to race to rotate.
The switch for each service
The table lists the setting, how to change it and the built-in Azure Policy definitions Microsoft documents for each. Names are as shown in Microsoft Learn in November 2026. Services are listed alphabetically.
| Service | Setting and where | Built-in audit or deny policy |
|---|---|---|
| App Configuration | Settings, Access settings, Enable access keys set to Disabled | App Configuration stores should have local authentication methods disabled |
| Application Insights | DisableLocalAuth: true on Microsoft.Insights/components; portal Configure, Properties | Application Insights components should block non-Azure Active Directory based ingestion |
| Azure AI services (Foundry Tools) | disableLocalAuth; Set-AzCognitiveServicesAccount -DisableLocalAuth $true | Azure AI Services resources should have key access disabled (disable local authentication) |
| Azure Cache for Redis | Authentication, Access keys, Disable Access Keys Authentication (Basic, Standard, Premium) | Azure Cache for Redis should not use access keys for authentication |
| Container Registry | Admin user off (it is off unless enabled); also anonymous pull, ARM audience tokens and repository scoped tokens | Container registries should have local admin account disabled |
| Cosmos DB | disableLocalAuth: true on Microsoft.DocumentDB/databaseAccounts; portal Key-based authentication set to Disable at creation | Cosmos DB database accounts should have local authentication methods disabled |
| Event Grid | disableLocalAuth on topics, domains and partner namespaces; portal Local Authentication, Disabled | Azure Event Grid topics (and domains, partner namespaces) should have local authentication methods disabled |
| Event Hubs | disableLocalAuth on the namespace | Azure Event Hub namespaces should have local authentication methods disabled |
| Service Bus | az servicebus namespace update --disable-local-auth true | Service Bus namespaces should have local authentication methods disabled |
| Storage | Allow storage account key access set to Disabled (AllowSharedKeyAccess false) | Covered in How to rotate Azure storage account keys and move to disabled Shared Key access |
Azure AI Search uses a mode rather than a property: under Settings, Keys choose Role-based access control instead of API Key or Both. Four services also have a Modify definition that switches keys off for you: "Configure App Configuration stores to disable local authentication methods", "Configure Cosmos DB database accounts to disable local authentication", "Configure container registries to disable local admin account" and the Event Grid "Configure ... to disable local authentication" definitions for topics, domains and partner namespaces. Cosmos DB also has a policy, "Azure Cosmos DB key based metadata write access should be disabled" (Append effect), which stops key holders changing databases and containers through the data plane. For the deep configuration of individual services, see the Azure Service Bus and Event Hubs Security, the Azure SQL and Cosmos DB Security Guide, the Azure OpenAI and Azure AI Foundry Security Guide and the Azure Container Registry Security Guide.
What changes when you flip the switch
The same word, "disable", has different consequences per service. Plan the cutover around them.
| Service | Documented effect | Rollback behaviour |
|---|---|---|
| App Configuration | All access keys are deleted; key-based clients fail. If the ARM authentication mode is local, ARM template reads and writes of key-values stop too, so Microsoft recommends pass-through mode | Re-enabling generates new keys; clients with the old keys still fail until updated |
| Application Insights | Only telemetry authenticated with Entra ID is ingested; senders need Monitoring Metrics Publisher. Some SDKs are unsupported, including the JavaScript SDK and the Java 2.x SDK (use the Java agent 3.2.0 or later) | Set the property back to false; templates are create-or-update, so include every property you want to keep |
| Azure AI services | Control plane changes at once, but the shared gateway can keep accepting old keys until its cache refreshes, usually minutes and up to several hours | Re-enabling has the same delay |
| Azure AI Search | Requests carrying an API key are refused; admin keys can be disabled but not deleted. Role assignments can take 5 to 10 minutes to apply | Switch back to Both or API Key |
| Azure Cache for Redis | All existing client connections are terminated, Entra or key; Entra authentication and at least one Redis user must exist first; geo-replicated caches must be unlinked first | Re-enable access keys in the same blade, again in a maintenance window |
| Container Registry | Every user of the admin credentials is cut off; some portal deployments to Container Instances and Container Apps still rely on the admin user | Re-enable the admin user and rotate its passwords |
| Cosmos DB | Key-based connections fail; data-plane roles are assigned with az cosmosdb sql role assignment create, not in the portal | Set disableLocalAuth back to false |
| Service Bus and Event Hubs | SAS rules remain but cannot produce working tokens | Set the property back to false; SAS works again |
A Deny policy assignment will also block re-enabling. Write the exemption process into your rollback plan before you switch policies to Deny.
Step-by-step: from inventory to enforced
- Inventory with Azure Resource Graph. Query the
Resourcestable per type and project the local authentication property. A sample shape:Resources | where type =~ 'Microsoft.ServiceBus/namespaces' | project name, resourceGroup, subscriptionId, properties.disableLocalAuth. Repeat forMicrosoft.EventHub/namespaces,Microsoft.EventGrid/topics,Microsoft.DocumentDB/databaseAccounts,Microsoft.CognitiveServices/accountsand the others in the table. Property paths are case-sensitive, and a missing value usually means the default (keys on). Run it withaz graph query -qacross all subscriptions you can read. - Assign the audit policies. Put the "should have local authentication methods disabled" definitions in a single initiative at management group scope with the Audit effect. The compliance view becomes your live inventory and progress chart. See the Azure Policy and Management Groups Guide.
- Find the callers. Use service evidence: Service Bus and Event Hubs runtime audit logs; Redis metrics Connected Clients against Connected Clients Using Microsoft Entra Token; Storage transaction metrics split by authentication type; for Cosmos DB, check the data-plane request table schema in your workspace for the authentication column before you rely on it. Add the Activity Log: any
listKeysor key regeneration call tells you which principal is fetching keys and therefore which application to migrate. - Give each caller an identity and a data role. Prefer a managed identity for workloads running in Azure, and a federated credential for workloads outside it (see How to replace Azure app secrets with federated credentials). Assign data-plane roles at the narrowest scope: Azure Service Bus Data Sender or Receiver on the entity, EventGrid Data Sender on the topic, Cosmos DB Built-in Data Contributor or Reader on the container, Monitoring Metrics Publisher on the Application Insights component.
- Change the client. Replace the connection string with the service endpoint plus a token credential, for example
DefaultAzureCredentialduring development andManagedIdentityCredentialin Azure. For App Service and Functions auto-instrumentation of Application Insights, Microsoft documentsAPPLICATIONINSIGHTS_AUTHENTICATION_STRINGwithAuthorization=AAD(or the user-assigned client ID). - Prove quiet with keys still on. Watch the evidence from step 3 for a full business cycle, including month-end jobs and disaster recovery tests. Only then disable.
- Disable per environment. Development, then test, then production. For Azure AI services, verify with an old key until it returns HTTP 401 rather than trusting the portal.
- Move policy to Deny and remediate. Switch the audit definitions to Deny for new resources. Where the Modify definitions exist, assign them with a managed identity and create remediation tasks for existing resources; Microsoft documents that remediation runs under the assignment's managed identity and that roles must be granted manually when assigning through the CLI, PowerShell or SDK.
- Clean up. Remove unused SAS rules and query keys, delete key copies from Key Vault, pipeline variables and app settings, and close the change record with the before and after compliance figures.
Decision guidance
| Situation | Approach | Trade-off |
|---|---|---|
| New resources (greenfield) | Deny policy from day one; templates set the property to true | Developers must use identities from the first commit; cheap now, expensive later |
| Existing estate with known owners | Audit, migrate per application, disable, then Modify with remediation | Slower, but each change is tested by the team that owns the client |
| Third-party or vendor client that only takes a key | Time-boxed policy exemption, narrowest key available (for example an entity-scoped Send rule), stored in Key Vault with an owner and rotation date | Residual risk is explicit and visible in compliance reports |
| SDK or runtime without Entra support | Upgrade the SDK first (for example the Java agent for Application Insights); if impossible, exempt and record | Upgrade work may be larger than the authentication change |
| Disruptive switch (Redis, Container Registry admin user) | Maintenance window, client retry logic confirmed, owner on call | Short planned outage instead of an unplanned one |
Small organisations can often do the whole estate in a few change windows: one subscription, a handful of resources, policy at subscription scope. Large organisations should run it as a programme with a management-group initiative, a compliance target per landing zone, and an exemption register reviewed monthly. Platform teams should bake disableLocalAuth: true into shared Bicep or Terraform modules so the default is right; see the Azure Bicep and ARM Template Security Guide.
Where identity fits
Disabling keys moves risk onto Entra identities, so those identities need the controls that keys never had. Each workload should have its own managed identity rather than one shared identity across many applications, so logs still tell you which application acted. Review data role assignments the same way you review human access, and remove the identities of decommissioned workloads. The Azure Managed Identities Security Guide covers identity choice and scoping, and the Service Principals vs Managed Identities page helps when a caller runs outside Azure.
Detection and measurement
- Configuration drift: Activity Log writes that set
disableLocalAuthback to false, re-enable App Configuration access keys or turn the Container Registry admin user on. Alert on each and require a linked change. - Key retrieval:
listKeys,listConnectionStringsand key regeneration operations on resources declared Entra-only. After cutover these should be rare. - Policy state: non-compliant resource counts per definition, and Deny events showing who tried to create a key-enabled resource.
- Service evidence: SAS authentication in Service Bus or Event Hubs runtime logs, and any gap between Redis connected clients and Entra-token clients.
Collect the Activity Log centrally as described in the Azure Monitor, Activity Log and Diagnostic Settings Guide. Metrics that show the programme is working:
- Percentage of in-scope resources compliant with the local authentication policies, per service and per landing zone.
- Number of active policy exemptions, each with an owner and an end date (target: falling).
- Count of
listKeyscalls per month on in-scope resource types (target: near zero). - Number of key or connection-string secrets still stored in Key Vault and pipeline variables for these services.
- Re-enablement events per quarter, each with a recorded reason.
Framework mapping
| Framework | Reference | How this work supports it |
|---|---|---|
| NIST CSF 2.0 | PR.AA-01, PR.AA-05 | Service credentials are managed identities with least-privilege data roles instead of shared keys |
| NIST CSF 2.0 | PR.PS-01 | Policy enforces the configuration across the estate |
| NIST SP 800-53 Rev 5 | IA-2, IA-5 | Callers are identified and authenticators are managed by the identity platform |
| NIST SP 800-53 Rev 5 | AC-6, CM-6 | Scoped data roles replace all-access keys; the setting is a managed configuration |
| ISO/IEC 27001:2022 Annex A | A.5.17 Authentication information, A.8.2 Privileged access rights | Shared secrets are removed and key-reading roles are reduced |
| MITRE ATT&CK | T1552.001, T1078.004 | Leaked keys stop working; access depends on cloud accounts that can be monitored and governed |
Common failure patterns
- Disabling before measuring: a nightly batch job or disaster recovery runbook still holds a connection string and fails at the worst time. Watch a full cycle first.
- Treating every service the same: Redis drops all connections and App Configuration deletes keys, so a "quick toggle" across services causes avoidable incidents.
- Trusting the portal for Azure AI services: old keys can keep working for hours after the change. Test with a key until you get HTTP 401.
- Deny with no exemption route: teams blocked by policy turn it off at a scope instead of requesting a dated exemption. Publish the process first.
- One shared identity replacing one shared key: the secret is gone but attribution and least privilege are still missing.
- Leaving key copies behind: keys in Key Vault, pipeline variables or app settings keep looking like live secrets in scans and confuse incident responders.
Practitioner checklist
- Run a Resource Graph inventory of every resource type in the switch table, with the local authentication property projected.
- Assign an initiative of the built-in audit definitions at management group scope.
- Identify callers from runtime logs, metrics and
listKeysevents for each resource. - Give each workload its own managed identity or federated credential with a narrowly scoped data role.
- Prove zero key traffic over a full business cycle before disabling.
- Disable per environment, using maintenance windows for Redis and the Container Registry admin user.
- Verify Azure AI services cutover with an old key returning HTTP 401.
- Move policies to Deny, assign Modify definitions with remediation tasks, and run a dated exemption register.
- Delete leftover keys, SAS rules and connection strings from vaults, pipelines and app settings.
- Alert on re-enablement and
listKeyson resources declared Entra-only.
Standards and references
- Microsoft Learn: Disable local authentication in Foundry Tools
- Microsoft Learn: Disable local authentication with Azure Service Bus
- Microsoft Learn: Disable access key authentication for Azure App Configuration
- Microsoft Learn: Use data plane role-based access control with Azure Cosmos DB for NoSQL
- Microsoft Learn: Microsoft Entra authentication for Application Insights
- Microsoft Learn: Use Microsoft Entra for Azure Cache for Redis authentication
- Microsoft Learn: Authenticate Event Grid publishing clients using Microsoft Entra ID
- Microsoft Learn: Remediate non-compliant resources with Azure Policy
Related NHI Mgmt Group resources: How to rotate Azure storage account keys and move to disabled Shared Key access · Azure Managed Identities Security Guide · Azure Policy and Management Groups Guide · Azure Service Bus and Event Hubs Security