Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.36k stars 4.71k forks source link

OpenAI token authentication fails in AzureUSGovernment cloud #44021

Open ebclark2 opened 4 months ago

ebclark2 commented 4 months ago

OpenAIClient token authentication fails in AzureUSGovernment cloud. This appears to be due to the token scope being hardcoded to commercial.

Possible cause: OpenAIClient AudienceScopes OpenAIClient AudienceScopes use

Error

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

Content:
{ "statusCode": 401, "message": "Unauthorized. Access token is missing, invalid, audience is incorrect (https://cognitiveservices.azure.us), or have expired." }

Headers:
x-ms-client-request-id: f2bfc643-5da9-4335-a6bd-b0cb156e9457
apim-request-id: REDACTED
Strict-Transport-Security: REDACTED
X-Content-Type-Options: REDACTED
Date: Mon, 13 May 2024 19:29:00 GMT
Content-Length: 160
Content-Type: application/json
github-actions[bot] commented 4 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jpalvarezl @trrwilson.

GreenCee commented 4 months ago

Tagging a previous issue in a different part of the library for awareness: https://github.com/Azure/azure-sdk-for-net/issues/18520

cf-rdegregory commented 4 months ago

We are running into the same issue...making Azure OpenAI unusable from our application in Azure Government.

In the Text Analytics issue linked by @GreenCee, as well as in multiple issues within the python SDK, this bug has been resolved.

@jpalvarezl @trrwilson do you have any update / insight to share on when a fix might be available for the Azure OpenAI SDK?