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

[monitor-query] Only works with Azure Commercial Cloud #15663

Closed
davemedvitz opened this issue Jun 10, 2021 · 5 comments · Fixed by #15705
Closed

[monitor-query] Only works with Azure Commercial Cloud #15663

davemedvitz opened this issue Jun 10, 2021 · 5 comments · Fixed by #15705
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Monitor Monitor, Monitor Ingestion, Monitor Query 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

@davemedvitz
Copy link

Consider the following code, using the AzureCLI auth method for local development.

    import { DefaultAzureCredential } from "@azure/identity";
    import { LogsQueryClient } from "@azure/monitor-query";

    const workspace = "7cxxxxx-xxxxx-xxxxx-xxxx-xxxxxxxxxxxx";

    const cred = new DefaultAzureCredential();
    const opts = {
        "endpoint": "https://api.loganalytics.us/v1"
    }

    const lac = new LogsQueryClient(cred,opts);
    lac.queryLogs(workspace,"Event","P30M");
    console.log(lac);

My expectation was that this would function, directing the client to the API endpoints in the Azure Gov Cloud. Instead, it errors on authentication.

As far as I can tell, there are two issues.

  1. The defaultMonitorScope variable is hard coded to the Commercial cloud. If I change this locally the authentication works, but the queries still fail.
  2. baseUri defaults to commercial and does not update to match endpoint (although $host does). Adjusting this locally appears to let the query work. (Not sure why this is an issue, as it appears to be set properly in the constructor for AzureLogAnalyticsContext )

I am using the 1.0.0-beta.1 version

Thank you.
Dave

@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jun 10, 2021
@davemedvitz
Copy link
Author

As a follow up to #2 above, it appears that the option endpoint is not a part of the options parameter in the call to the AzureLogAnalytics constuctor from the LogsQueryClient constructor.

@ramya-rao-a ramya-rao-a added Monitor - Query Client This issue points to a problem in the data-plane of the library. labels Jun 10, 2021
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Jun 10, 2021
@ghost ghost added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Jun 10, 2021
@ramya-rao-a
Copy link
Contributor

Thanks for reporting @davemedvitz

@richardpark-msft Can you take an initial look here and loop in Daniel as needed if this is an Identity issue?

@richardpark-msft
Copy link
Member

@davemedvitz - I'll take a look at this today.

I believe I just need to plumb the proper endpoint through a little further, so hopefully not an identity issue.

@scottaddie
Copy link
Member

@davemedvitz I'm very interested in talking to customers about their use cases and the beta 1 SDK that shipped last week. Please email me at scott dot addie at microsoft dot com if you're interested. Any feedback you can provide will help us build a better SDK for you and other customers.

richardpark-msft added a commit that referenced this issue Jun 14, 2021
…horization scopes. (#15705)

This PR makes it so you can pass in a custom endpoint and custom scopes for authentication. Without these you can't properly connect to government-based clouds.

Example usage:

```typescript
  const dac = new DefaultAzureCredential({
    authorityHost: AzureAuthorityHosts.AzureGovernment
  });

  const client = new LogsQueryClient(dac, {
    endpoint: "https://api.loganalytics.us/v1",
    scopes: "https://api.loganalytics.us/.default"
  });
```

Fixes #15663
@richardpark-msft
Copy link
Member

@davemedvitz : we've now released 1.0.0-beta.2 based which fixes your issue:

https://www.npmjs.com/package/@azure/monitor-query/v/1.0.0-beta.2

Thank you very much for reporting this issue.

sadasant pushed a commit to sadasant/azure-sdk-for-js that referenced this issue Jun 21, 2021
…horization scopes. (Azure#15705)

This PR makes it so you can pass in a custom endpoint and custom scopes for authentication. Without these you can't properly connect to government-based clouds.

Example usage:

```typescript
  const dac = new DefaultAzureCredential({
    authorityHost: AzureAuthorityHosts.AzureGovernment
  });

  const client = new LogsQueryClient(dac, {
    endpoint: "https://api.loganalytics.us/v1",
    scopes: "https://api.loganalytics.us/.default"
  });
```

Fixes Azure#15663
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
@scottaddie scottaddie added Monitor Monitor, Monitor Ingestion, Monitor Query and removed Monitor - Query labels Sep 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Monitor Monitor, Monitor Ingestion, Monitor Query 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
4 participants