I've setup an application gateway and key vault using Terraform. All seems to work with the application gateway if I store the certificate locally, but if I set it to use a certificate from the key vault, then browse to the site, I get the error ERR_SSL_UNRECOGNIZED_NAME_ALERT
, implying that the listener has been disabled.
I've seen others have reported similar issues (e.g. Azure Application Gateway, how to link to SSL Cert on a different Azure Subscription?); though none of the answers there work for me / some are now out of date.
ERR_SSL_UNRECOGNIZED_NAME_ALERT
exception to reappear). Set-AzApplicationGatewaySslCertificate -ApplicationGateway $appGw -Name 'wildcard-example-com' -KeyVaultSecretId 'https://myKeyVault.vault.azure.net/secrets/wildcard-example-com/' -Verbose | Set-AzApplicationGateway -Verbose
UK South
).Microsoft.KeyVault service endpoint
associatedDisable public access
and Allow trusted Microsoft services to bypass this firewall
setget
permissions for secrets (in fact, I've currently granted every permission available, just to discount security policies as being the potential cause). Note: I'm using vault access policy
; not RBAC
./secrets/
path, and doesn't include version information.Is there anything I've missed, or are there any debugging steps I can take to get more info on why AppGW is failing to load this certificate from the KeyVault?
I had a call with MS Support where they were able to resolve my issue.
The private dns zone
used by key vault, privatelink.vaultcore.azure.net
had Virtual Network Links
configured with the VNet in which my domain controllers sit; these domain controllers have conditional dns forwarders for the various zones including vaultcore.azure.net
forwarding requests to 168.63.129.16
. This means that when our DCs are used for DNS, they resolve resources to the internal IP of the private endpoints.
However, though the VNet to which the AppGW is correctly configured to use our DNS servers, and thus should be using the internal IP to connect to the Key Vault securely, that doesn't seem to have happenned.
By adding another Virtual Network Link
to our privatelink.vaultcore.azure.net
zone, targetting the App Gateway's VNet, all began to work.
Note: Immediately after making the above change things still failed; I found that running Set-AzApplicationGatewaySslCertificate -ApplicationGateway $appGw -Name 'wildcard-example-com' -KeyVaultSecretId 'https://myKeyVault.vault.azure.net:443/secrets/wildcard-example-com/' -Verbose | Set-AzApplicationGateway -Verbose
caused the AppGW to retry pulling the cert, thus triggering it to take advantage of the now fixed issue. (I'm not sure if it's important, but each time I ran the above command I'd alternate between including the :443
port info to ensure the string was different, so a change would be detected.
Hope that's helpful to others in future.