How to Rotate Azure API Management Credentials
How to rotate Azure API Management credentials after an exposure: inventory seven secret classes, replace at the issuer, update APIM, revoke, then hunt.
To rotate Azure API Management credentials after an exposure, inventory every secret the instance holds, create a replacement at the system that issued each one, update APIM, test the APIs, then revoke the old credential at the issuer. Updating the value inside APIM alone does not invalidate the old secret. This is the sequence Microsoft published on November 21, 2026 for the APIM Classic flaw CVE-2026-139934, and it applies to any gateway credential exposure.
Why does rotating in APIM alone not work?
API Management stores a copy of a credential that some other system issued and still trusts. Changing the copy in APIM changes what APIM sends, but the backend, identity provider or Key Vault still accepts the old value until you revoke it there. Microsoft's rotation guide states the rule in one line: updating the value in API Management does not revoke the old credential at its issuer.
That is the whole reason the November 2026 incident needed customer action. Microsoft closed the access path on November 19, but any secret read before that date stayed valid everywhere it was issued.
Step 1: Scope the instances
List every APIM instance you own, across subscriptions, including development and test. Record the tier, because the 2026 flaw affected Classic Developer, Basic, Standard and Premium, not v2 or Consumption. The CLI calls below are adapted from Microsoft's rotation guide as reproduced by Ostorlab:
az apim list --subscription <subscription-id> \
--query "[].{name:name, resourceGroup:resourceGroup}" --output table
az apim show --name <apim-name> --resource-group <resource-group> \
--query "{sku:sku.name, provisioningState:provisioningState}" --output table
For instances across all readable subscriptions, use Azure Resource Graph:
az graph query -q "resources | where type =~ 'microsoft.apimanagement/service' | project name, resourceGroup, subscriptionId, location" --output table
If Microsoft has issued a Service Health security advisory, open the Impacted Resources tab under Service Health, Security Advisories, with an account holding Subscription Owner, Contributor, Service Health Security reader or a tenant-level Security or Global admin role. Record which instances Microsoft lists. Treat any Classic instance you cannot rule out as exposed.
Step 2: Inventory every credential class
Microsoft's guide covers seven places APIM keeps secrets. Build a spreadsheet with one row per credential and a column for its issuer:
- Subscription keys: primary and secondary key on every subscription, including the built-in all-access subscription.
- Named values of type secret or key vault. For key vault types, note the vault and secret name. APIM named values are the most common place backend keys end up.
- Backend credentials: headers, query parameters and client certificates configured on backend entities.
- OAuth 2.0 authorization server and OpenID Connect provider client secrets.
- Developer portal identity provider client secrets (Entra ID, Azure AD B2C, external providers).
- Logger connection strings, for example Event Hubs loggers.
- Credentials written directly into policy XML. Search policy text for header values and connection strings that should have been named values.
Add two items Microsoft listed as potentially exposed in November 2026 and that Anders Kristiansen's checklist includes: the instance's tenant access keys, and any app registration secrets whose values were stored anywhere above.
Step 3: Rotate in the safe order
Microsoft's guide gives an order for cases where both credentials can remain valid during the switch:
- Create the replacement credential at the issuer: generate a new key at the backend, add a new client secret to the app registration, or create a new secret version in Key Vault.
- Update API Management with the new value (edit the named value, backend, authorization server or policy).
- Test the APIs that use it. Call through the gateway and confirm the backend accepts the new credential.
- Revoke the old credential at the issuer: delete the old key, remove the old client secret, disable the old Key Vault secret version.
For key vault named values with a versionless identifier, step 2 happens on its own: Microsoft says APIM picks up the new vault value within four hours, or immediately if you refresh from the portal or the management REST API. Step 4 is still manual.
Subscription keys are the exception. You regenerate them inside APIM because APIM is the issuer. Regenerate both primary and secondary, and remember that the subscription identifier does not change, so a log search for "new subscription IDs" will not show the rotation.
If you cannot rotate a credential yet, remove it from APIM or disable the dependent API until you can. Blocking network access to the gateway does not revoke a secret the backend still accepts.
Step 4: Close the legacy paths
Rotation handles what was taken. These steps shrink what the next management-plane flaw can reach:
- Disable the direct management API on every instance. In the portal, set Management API, Enable Management REST API to No. Microsoft retired this endpoint on March 15, 2025 and says to disable it if it is still enabled. It authenticates with SharedAccessSignature tokens, bypasses Entra ID and RBAC, and does not write to the Activity log.
- Review APIM users. Remove accounts you do not recognize and restrict who can edit policies or enable request tracing; both can expose named values.
- Unpublish the developer portal if unused. If you need it, disable open sign-up, remove identity providers you no longer use and require approval on every product.
- Compare the configuration against your change records. Microsoft's guide lists reviewing subscriptions, users, policies and backends you did not create as a best practice.
Step 5: Hunt where the credentials were used
Microsoft published no indicators of compromise for the 2026 incident, and the legacy API path would not appear in the ARM Activity log. So the evidence, if any, is downstream. Kristiansen's hunting map covers six log sources; the three with the highest yield are:
- Entra service principal sign-ins (AADServicePrincipalSignInLogs): sign-ins for apps whose client secrets were stored in APIM, from IP addresses not seen in your baseline period, or one app requesting tokens for many resources in a short window.
- Key Vault audit logs (AZKVAuditLogs or AzureDiagnostics with AuditEvent): who listed or read the secrets APIM references, grouped by caller and time window.
- APIM gateway logs (ApiManagementGatewayLogs): subscription identifiers new to the baseline, and requests where tracing was requested and allowed.
Collect the application (client) IDs from named values, backends and identity providers before you query, and widen the windows as far as retention allows. An empty result from a table you enabled last week tells you nothing about what happened last month.
How do you prove the rotation happened?
Keep a record per credential: issuer, date created, date APIM updated, date old value revoked, and who did it. Microsoft said secrets rotated after its November 21 or November 24, 2026 Service Health notifications did not need rotating again, but only an organization with a dated record could show that. CISA's KEV entry for CVE-2026-139934 marks forensic triage as required under BOD 26-04, and auditors and insurers ask the same question in different words.
What should change permanently?
Put the credential inventory from Step 2 under version control and review it quarterly. Prefer managed identity over stored keys wherever the backend supports Entra authentication, so there is nothing to rotate. Move remaining secrets to key vault references with versionless identifiers. And give Azure Service Health notifications a named owner, because Microsoft's first and second warnings about this flaw went there, two weeks before the CVE existed.