Fix: AccessToKeyVaultDenied when using KeyVault with Function App application setting
After following the instructions on the MS website to establish a KeyVault reference and place that in my App Settings, I set up a Managed Service Identity and grant that identity access to my KeyVault key. Next, wishing to follow Microsoft’s advice and secured a firewall around the KeyVault, ensuring that I checked the
Allow trusted Microsoft services to bypass this firewall? setting, however, I was still receiving an
I even checked and yes, App Service is supposed to be able to bypass the firewall – so what was going on? Well, on the KeyVault resolver reference page it has this text:
Key Vault references are not presently able to resolve secrets stored in a key vault with network restrictions.
That seemed ok when i first read it as after all, there’s an explicit setting to bypass the firewall. But when i disabled network firewall (allow access from
all networks), everything suddenly worked, and the key status is
Resolved with a nice green tick: