Share via

Access denied due to invalid subscription key or wrong API endpoint only on web deployment

Tristan Coulange 5 Reputation points
2024-10-09T13:44:59.5866667+00:00

Hi, my problem is that I've deployed a new model from Azure OpenAI (gpt-4o). It perfectly works with API calls or in the playground, but when I deploy it in a webapp, I got the error message "Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource."

The web deployment works, is active but it can't reply to any prompts.
My Azure OpenAI and App Service ressources are in the same region (France Central)

Any help would be appreciated, thank you
User's image
Here my model works in the playground ...

User's image

...But it doesn't work anymore on a web application

Azure OpenAI in Foundry Models
Azure App Service
Azure App Service

Azure App Service is a service used to create and deploy scalable, mission-critical web apps.


1 answer

Sort by: Most helpful
  1. Tristan Coulange 5 Reputation points
    2024-10-14T09:04:13.0266667+00:00

    Like in Daniel Fang's comment, the problem was indeed an environment varibale problem: my AZURE_OPENAI_KEY was empty. All other parameters were correctly filled.

    Thanks all for your answers !

    User's image

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

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.