Key Vault references with network restrictions not working in App Service

Kim 21 Reputation points
2021-04-06T14:51:25.677+00:00

It was announced on March 31st 2021 that Key Vault references in App Services with VNet integration would now work but for us it isn't.

  • VNet integration has been enabled to subnet A in VNet X in the App Service.
  • Key Vault has been configured to allow connections from subnet B in VNet X.
  • No NSGs.
  • Key Vault reference in App Service configuration: @Microsoft.KeyVault(SecretUri=https://<keyvaultname>.vault.azure.net/secrets/<secretname>/<version>)
  • App Service and Key Vault are in the same region.
  • App Service managed identity has been enabled.
  • Get and List permissions have been granted to the managed identity in the Access policies page.
  • App Service stack: .NET v4.8

The Key Vault reference shows up with an error icon in the App Service configuration page in Azure Portal. Key Vault's AuditEvent log says: "Client address is not authorized and caller is not a trusted service."

The IP address in the log message is one of the public IPs listed in the Additional Outbound IP Addresses list on the Properties page in App Service.

The configuration works if I disable the network restriction in the Key Vault.

Is there some other restrictions or what are we doing wrong here?

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.
1,127 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,920 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andriy Bilous 10,976 Reputation points MVP
    2021-04-06T17:52:49.3+00:00

    Hello anonymous user
    When you are integrating WebApp into VNET, all outbound traffic from WebApp to VNET resources will originated from last IP address in VNET.

    Example: WebApp integrates into VNET subnet 192.168.0.0/24
    WebApp's outbound traffic to VNET resources will go from IP 192.168.0.254

    In your case configure Key Vault to allow connections from subnet A in VNet X.

    0 comments No comments

0 additional answers

Sort by: Most helpful