Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Unable to Authenticate AzureDocumentIntelligenceClient on AzureGovernment #48524

Open
coryisakson opened this issue Mar 3, 2025 · 1 comment
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. Cognitive - Form Recognizer customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@coryisakson
Copy link

coryisakson commented Mar 3, 2025

Library name and version

Azure.AI.DocumentIntelligence 1.0.0

Describe the bug

API calls result in an error when deployed to AzureGovernment.

I am using the DocumentIntelligenceClient and DefaultAzureCredential

The SDK client currently uses a hardcoded Scopes value that points to the Public cloud.

https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/documentintelligence/Azure.AI.DocumentIntelligence/src/Generated/DocumentIntelligenceClient.cs#L89

Please provide an option to set the Audience like most other Azure Clients offer in their Options/ConfigureOptions. Alternatively detect which cloud the service is running on and set the Scopes string to match.

Expected behavior

Client operations such as AnalyzeDocumentAsync succeed without 401 authentication errors

Actual behavior

Error Details
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." }

Reproduction Steps

Deploy Document Intelligence service in AzureGovernment and capture the endpoint.

Execute the following code from an App Service hosted in AzureGovernment

var _client = new DocumentIntelligenceClient(new Uri("https://.cognitiveservices.azure.us/"), new DefaultAzureCredential());

var operation = await _client.AnalyzeDocumentAsync(WaitUntil.Completed, analyzeDocumentOptions, cancellationToken);

Environment

Azure AppService running .net core 8 on Linux

@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Mar 3, 2025
@jsquire jsquire added Client This issue points to a problem in the data-plane of the library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team Cognitive - Form Recognizer and removed needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Mar 4, 2025
@jsquire
Copy link
Member

jsquire commented Mar 4, 2025

Thank you for your feedback. Tagging and routing to the team member best able to assist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. Cognitive - Form Recognizer customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

3 participants