-| `401 Unauthorized. Access token is missing, invalid, audience is incorrect (https://cognitiveservices.azure.com), or have expired.` | The request is failing to perform authentication with Entra ID as expected. The root case may be related with: <br /> 1. The request is not passing the tokens as part of the `Authentication` header. <br /> 2. The request is passing a token in the `Authentication` header, but the scope is incorrect. 3. The request is using an expired token. | Ensure the following: <br /> 1. If you are using REST API calls, ensure that the token is passes under the `Authentication` header with an scope `https://cognitiveservices.azure.com/.default`. <br /> 2. If you are using `AzureOpenAI` class from an SDK, ensure that you are using an **OpenAI model** connected to the endpoint `https://<resource>.openai.azure.com`. You can't use `OpenAI` class or a non Azure OpenAI model. If your model is not from OpenAI, use the Azure AI Inference SDK. <br /> If you're using the Azure AI Inference SDK, ensure you are connected to the endpoint `https://<resource>.services.ai.azure.com/model`. You can use this endpoint with all the model providers. |
0 commit comments