Unable to import certificate from the key vault to the App Service Certificate.

Puja Manna (Accenture International Limited) 25 Reputation points Microsoft External Staff
2026-08-03T12:31:27.86+00:00

Unable to import certificate from the key vault to the App Service Certificate. Getting forbidden error. Also provided the Microsoft.Azure.WebSites the certificate user and officer access but still getting forbidden error.

Import-AzWebAppKeyVaultCertificate
Operation returned an invalid status code 'Forbidden'

Azure Key Vault
Azure Key Vault

An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Jose Benjamin Solis Nolasco 10,651 Reputation points Volunteer Moderator
    2026-08-03T14:08:28+00:00

    Hello @Puja Manna (Accenture International Limited) I hope you are doing well,

    Welcome to Microsoft Q&A.

    A 403 Forbidden from Import-AzWebAppKeyVaultCertificate indicates that the App Service operation is being denied when accessing the certificate or Key Vault. Since you have already assigned permissions to Microsoft.Azure.WebSites, I would first verify the following:

    Confirm the App Service has a system-assigned or user-assigned managed identity enabled, if the certificate is being accessed through managed identity.

    Check the Key Vault access model. If the vault uses Azure RBAC, ensure the appropriate Key Vault certificate/secret permissions are assigned to the identity performing the import.

    If the Key Vault uses access policies, verify that the relevant identity has Get permissions for both Certificates and Secrets, since App Service certificates may require access to the underlying secret.

    Check the Key Vault networking configuration. If public network access is disabled or restricted by firewall/private endpoint, verify that the operation has an allowed network path to the vault.

    Confirm that the certificate exists in the specified Key Vault and that the identity has permission to retrieve it.

    You can also run the command with verbose/debug logging to obtain more information about where the 403 is being returned:

    Import-AzWebAppKeyVaultCertificate ... -Verbose

    If all RBAC/access-policy and networking settings are correct and the operation still returns 403, please provide the sanitized command, Key Vault access model, networking configuration, and the relevant error details. At that point, the exact authorization path can be narrowed down further.

    Avoid granting broad permissions such as Owner or Contributor just to test the issue; the goal is to identify the specific missing permission.

    If this is blocking a production certificate deployment and the configuration is already confirmed, opening an Azure support request would also be appropriate so Microsoft can investigate the authorization failure from the service side.

    If my answer helped, please consider marking it as accepted.

    Was this answer helpful?


  2. AI answer

    2026-08-03T12:31:47.6466667+00:00

    Forbidden in this scenario usually means the wrong identity has permission, or the vault/certificate setup still blocks App Service.

    Use this checklist:

    1. 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.
    2. 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-5855508787cd Azure CLI 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>"
      
      PowerShell example:
         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>"
      
    3. If the vault uses access policies instead of RBAC, grant the App Service resource provider:
      • Secret permissions: Get
      • Certificate permissions: Get
    4. Do not rely on managed identity, Owner, or broader roles alone for this operation.
      Multiple documented cases show the import can still fail unless Microsoft.Azure.WebSites has the required Key Vault access.
    5. 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.
    6. 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.
    7. 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.
    8. 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:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.