Unable to run Azure Monitor queries in US Government cloud
See original GitHub issue- Package Name: @azure/monitor-query
- Package Version: 1.0.2
- Operating system: Windows
- nodejs
- version: 16.15.0
- browser
- name/version:
- typescript
- version: 4.7.3
- Is the bug related to documentation in
- README.md
- source code documentation
- SDK API docs on https://docs.microsoft.com
Describe the bug
It doesn’t appear to be possible to create a LogQueryClient
capable of querying workspaces in the government cloud. When setting endpoint
to “https://api.loganalytics.us/v1”, the client is unable to get an access token. When setting endpoint
to “https://api.loganalytics.us”, the client gets a token but sends the queries to an invalid url, e.g. https://api.loganalytics.us/workspaces/[workspaceid]/query.
To Reproduce Steps to reproduce the behavior:
- Create a client
const client = new LogsQueryClient(new DefaultAzureCredential({ authorityHost: azureAuthorityHosts.AzureGovernment }), { endpoint: 'https://api.loganalytics.us/v1' });
- Run a query
await client.queryWorkspace(workspaceId, 'AppRequests', { duration: Durations.fiveMinutes });
- Error is thrown:
CredentialUnavailableError: ERROR: AADSTS500011: The resource principal named https://api.loganalytics.us/v1 was not found in the tenant named XXXXXXXXXX. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant.
- Replace
endpoint
with'https://api.loganalytics.us'
and run a query - Error is thrown:
RestError: The requested path does not exist
The path being requested is https://api.loganalytics.us/workspaces/[workspaceId]/query (missing /v1/workspaces/[workspaceId]/query)
Expected behavior
Not sure which value was meant to be in endpoint
, but either way there should be a way to query workspaces in the government cloud.
Screenshots
Additional context
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Unable to run Azure Monitor queries in US Government cloud ...
This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). ... Unable to run Azure Monitor queries in...
Read more >Troubleshoot issues with the Log Analytics agent for Windows
Describe the symptoms, causes, and resolution for the most common issues with the Log Analytics agent for Windows in Azure Monitor.
Read more >Azure Government Azure Monitor logs - Microsoft Learn
This article describes how Azure Monitor logs is applicable to US Government agencies and solution providers.
Read more >Azure Monitor FAQ - Microsoft Learn
In the Azure portal, you can write and run queries and interactively analyze data using Log Analytics. Analyze metrics in the Azure portal...
Read more >How to use Azure Monitor for Azure Government
In this episode of the Azure Government videos series, we explore Azure Monitor on Azure Government. What is Azure Monitor?
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thank you @actong for reporting this, and @mpodwysocki for fixing! Confirming that version 1.0.3 without the
v1/
worked for me in Government.Thanks for confirming the fix @dsab123 ! I’m going to go ahead and close this issue for now but @actong please let us know if you have any further trouble.