How to fix "azure.core.exceptions.ClientAuthenticationError: (None) Unauthorized. Access token is missing, invalid, audience is incorrect (https://cognitiveservices.azure.com), or have expired" during RAG creation tutorial?

Rebecca Molnar 0 Reputation points
2025-01-13T19:00:08.5666667+00:00

I am trying to follow the steps of the tutorial: https://learn.microsoft.com/en-us/azure/ai-studio/tutorials/copilot-sdk-build-rag

I keep getting the error:

azure.core.exceptions.ClientAuthenticationError: (None) Unauthorized. Access token is missing, invalid, audience is incorrect (https://cognitiveservices.azure.com), or have expired.

Code: None

Message: Unauthorized. Access token is missing, invalid, audience is incorrect (https://cognitiveservices.azure.com), or have expired

I've triple checked my .env file to make sure everything is correct. The code is a direct copy of what is in the tutorial and I've double checked that everything is in the same region. I've tried re-logging into the CLI to make sure it's not that too. The code doesn't specify an api key, which I'm thinking maybe that's what it needs?

Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
3,043 questions
{count} votes

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.