question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

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:

  1. Create a client const client = new LogsQueryClient(new DefaultAzureCredential({ authorityHost: azureAuthorityHosts.AzureGovernment }), { endpoint: 'https://api.loganalytics.us/v1' });
  2. Run a query await client.queryWorkspace(workspaceId, 'AppRequests', { duration: Durations.fiveMinutes });
  3. 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.
  4. Replace endpoint with 'https://api.loganalytics.us' and run a query
  5. 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:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dsab123commented, Oct 6, 2022

Thank you @actong for reporting this, and @mpodwysocki for fixing! Confirming that version 1.0.3 without the v1/ worked for me in Government.

0reactions
xirzeccommented, Oct 7, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found