Integrating Azure App Service with Azure Key Vault: How to securely reference secrets via managed identities
0 reputation · 18 Apr 2020, 08:50 UTC
0 reputation · 18 Apr 2020, 08:50 UTC
We need to expose a Key Vault secret to an Azure App Service web app using a managed identity, so that the secret value can be resolved at runtime without embedding credentials in code or configuration.
Key Vault access must be granted to the App Service’s system‑assigned or user‑assigned identity. The App Service plan must run on a runtime stack that supports the built‑in secret reference syntax (Azure App Service 2.0+). Cross‑subscription scenarios require tenant‑level Azure AD permissions, and secret rotation does not automatically refresh the value in a running instance unless the app is restarted or the “restart on secret change” feature is enabled.
While the documentation states that the @Microsoft.KeyVault(SecretUri=…) syntax works on all 2.0+ stacks, older stacks may silently ignore the reference, and access policy changes can cause intermittent 500 errors if the identity temporarily loses permission. Latency spikes can occur when the Key Vault resides in a different subscription or region.
A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.