Description:
This control ensures that sensitive data such as passwords, API keys, and connection strings are securely stored in Azure Key Vault rather than in code or configuration files. It provides centralized management, strong access control, encryption, and audit logging, reducing exposure risk and supporting security and compliance requirements.
Rationale:
Storing secrets in unmanaged locations risks unauthorized access. Using Azure Key Vault ensures secure storage with access controls, logging, and encryption, restricting access to authorized users and applications while supporting compliance with standards like PCI-DSS, HIPAA, and ISO 27001.
Impact:
Azure Key Vault centralises secret management, simplifies auditing, and integrates with Azure Active Directory for strong access control. It encrypts data at rest and in transit, reduces accidental exposure of sensitive information, and helps organisations meet industry and regulatory compliance requirements.
Default Value:
By default, Azure App Service does not use Azure Key Vault to store secrets unless explicitly configured.
Pre-requisites:
Azure Key Vault is available
Secrets identified
Application has access to Key Vault
Test Plan:
Sign in to the Azure Portal https://portal.azure.com
Open the Web App.
Under Settings, select Environment variables in App settings.
Check if secret values use Azure Key Vault reference, for example:
@Microsoft.KeyVault(SecretUri=https://<keyvault-name>.vault.azure.net/secrets/<secret-name>)Ensure no passwords, keys, or connection strings are stored in plain text.
Click Pull reference values to confirm the reference resolves.
If secrets are not stored in Azure Key Vault, follow the implementation steps.
Implementation steps:
Sign in to the Azure Portal https://portal.azure.com
Create or select an Azure Key Vault.
In the Key Vault, under objects, open Secrets, Generate/Import, and add the required secret (password, key, or connection string).
Go to the Web App, Identity, and enable System-assigned managed identity.
In Key Vault, Access control (IAM), assign the role Key Vault Secrets User to the Web App’s managed identity.
Under Settings, select Environment variables in App settings.
Add or update the app setting value using a Key Vault reference, for example:
@Microsoft.KeyVault(SecretUri=https://<keyvault-name>.vault.azure.net/secrets/<secret-name>)Save the configuration and restart the Web App.
Backout Plan:
Sign in to the Azure Portal https://portal.azure.com
Open the Web App.
Under Settings, select Environment variables in App settings.
Identify the application settings that reference Azure Key Vault.
Replace the Key Vault reference with the previous value if required, or remove the setting.
Save the configuration changes.
Restart the Web App to apply the rollback.
If no longer needed, remove the Web App managed identity role assignment from the Key Vault.
Optionally disable or delete the secret from Azure Key Vault if it is no longer required.
References:
https://learn.microsoft.com/en-us/azure/key-vault/general/overview
https://docs.microsoft.com/en-us/azure/keyvault/secrets/quick-create-portal
https://docs.microsoft.com/en-us/azure/key-vault/general/overview-access-control