Cannot communicate with Key Vault from Static Web App

dotnet_guy 15 Reputation points
2025-07-01T02:47:33.3166667+00:00

Hello,

We currently have a static web app using a private endpoint and have an app setting with the recommended KV setting, but get an error message

'Client address is not authorized and caller is not a trusted service...'

And the IP address is not related to private endpoint in static web app. Is there a secure way for static web app to talk to KV? We are using Standard tier.

I am using the client_id and secret from Azure app registration in the staticwebapp.config.json auth{} section for authenticating swa using Entra.
https://learn.microsoft.com/en-us/azure/static-web-apps/authentication-custom?tabs=aad%2Cinvitations#microsoft-entra-version-2

And if I directly use the id and secret in the app_setting on Azure, swa works but not with KV reference
https://learn.microsoft.com/en-us/azure/static-web-apps/key-vault-secrets

Please let me know if I am missing something. I see a few issues in SWA GitHub, not sure if this is still an issue

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,181 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Obinna Ejidike 2,455 Reputation points
    2025-07-01T15:38:07.6133333+00:00

    Hello dotnet_guy

    Unfortunately, static web apps do not support the vNet integration feature, so all traffic from your static web app is going via the internet.

    Private endpoints are for inbound traffic to the static web app, so by enabling private endpoints, you allow resources on your vNet to be able to talk to your static web app; this does not allow for the opposite, for your static web app to talk to resources on the vNet.

    This explains why I suggested using a selected virtual network on the key vault, which would allow you to specify IP ranges that need to securely connect to the Azure Key Vault.

    You can mark it 'Accept Answer' and 'Upvote' if this helped you.

    Regards,

    Obinna.

    0 comments No comments

Your answer

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