When Key Vault references come back empty or show as "Not Resolved", the cause is often the keyVaultReferenceIdentity property that the portal hides. The guide shows how to bind a user-assigned managed identity to App Service via an ARM PATCH, Azure CLI, Bicep and Terraform.
Key points
- keyVaultReferenceIdentity exists only at the ARM level and cannot be managed from the Azure portal.
- The fix is a PowerShell PATCH against Microsoft.Web/sites using api-version=2021-01-01.
- The Invoke-AzRestMethod payload writes the identity's full resource ID into properties.keyVaultReferenceIdentity.
- The App Service must be restarted before the new identity setting takes effect.
- Azure CLI can do the same through az webapp update --set properties.keyVaultReferenceIdentity.
- The most common failures are running the script before the managed identity is assigned or under the wrong subscription context.
Real-world use
- App Service apps whose @Microsoft.KeyVault(...) app-setting references fail as "Not Resolved" with 401/403 errors.
- Teams that keep secrets in Key Vault and want a user-assigned managed identity instead of the system-assigned one.
- Teams managing infrastructure with Bicep or Terraform who want the portal-hidden property persisted in code.
This summary was generated by the agent from the original post on DEV Community: #dotnet. The full text and all rights belong to its author and publisher. Go to original