An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
Forbidden in this scenario usually means the wrong identity has permission, or the vault/certificate setup still blocks App Service.
Use this checklist:
- Grant access to the App Service resource provider, not only the web app managed identity.
For Key Vault certificate import into App Service, the identity that reads the certificate is Microsoft Azure App Service /Microsoft.Azure.WebSites. - If the vault uses Azure RBAC, assign Key Vault Certificate User to the App Service resource provider on the Key Vault scope.
The App Service resource provider application ID for Azure Cloud is:abfa0a7c-a6b6-4736-8310-5855508787cdAzure CLI example:
PowerShell example:az role assignment create --role "Key Vault Certificate User" --assignee "abfa0a7c-a6b6-4736-8310-5855508787cd" --scope "/subscriptions/<subscription-id>/resourcegroups/<resource-group-name>/providers/Microsoft.KeyVault/vaults/<key-vault-name>"New-AzRoleAssignment -RoleDefinitionName "Key Vault Certificate User" -ApplicationId "abfa0a7c-a6b6-4736-8310-5855508787cd" -Scope "/subscriptions/<subscription-id>/resourcegroups/<resource-group-name>/providers/Microsoft.KeyVault/vaults/<vault-name>" - If the vault uses access policies instead of RBAC, grant the App Service resource provider:
- Secret permissions:
Get - Certificate permissions:
Get
- Secret permissions:
- Do not rely on managed identity, Owner, or broader roles alone for this operation.
Multiple documented cases show the import can still fail unlessMicrosoft.Azure.WebSiteshas the required Key Vault access. - If the Key Vault has firewall/public network restrictions, enable Allow trusted Microsoft services to bypass this firewall. Otherwise App Service can be blocked from reading the certificate.
- Verify the certificate itself is supported:
- App Service import from Key Vault expects a PKCS12 certificate.
- If import fails after permissions are correct, the certificate may not meet App Service requirements.
- A documented case showed an ECC certificate imported into Key Vault but failed for App Service import, while a supported certificate worked.
- If the failure is during certificate import into Key Vault itself, make sure the user running the import has Key Vault Certificates Officer or equivalent certificate import permission. For portal imports, using Azure CLI or PowerShell can show a more descriptive error.
- After changing permissions, wait a few minutes and retry
Import-AzWebAppKeyVaultCertificate.
If the vault is already using RBAC and Key Vault Certificate User was assigned to Microsoft.Azure.WebSites, the next two checks are the most likely causes:
- Key Vault firewall/private access is blocking Azure services.
- The certificate format/content is unsupported for App Service import.
References:
- Add and manage TLS/SSL certificates in Azure App Service
- Importing Azure Key Vault certificates FAQ
- Troubleshoot Azure App Service certificates
- I am getting an error when trying to import a certificate from Key Vault to App Service - Microsoft Q&A I am an owner of an App Service
- Certificate addition/binding to an App service from a key vault fails - Microsoft Q&A I have a key vault with IAM setup. It has a lets's encrypt certificate on it.
- Quickstart: Set and retrieve a certificate from Azure Key Vault using Azure PowerShell