azuredatastudio: Unable to get a token for Data Explorer/Log Analytics clusters hosted on Azure China

  • Azure Data Studio Version: 1.42.0
  • OS Version: Windows 11 Enterprise 22H2

Steps to Reproduce:

Scenario 1 (Azure Data Explorer) :

  • Add an Azure account hosted in Azure China
  • Attempt to connect to an Azure Data Explorer Cluster (optional parameters omitted)
Connection type : Azure Data Explorer (Kusto)
Cluster : <cluster-url>
Authentication type : Azure Active Directory - Universal with MFA support
Account : <az-china-account>
Database : <Default>
  • Connect, get the following error :
Error: failed to get token.

Scenario 2 (Log Analytics Workspace) :

  • Add an Azure account hosted in Azure China
  • Attempt to connect to a Log Analytics Workspace (optional parameters omitted)
Connection type : Azure Monitor Logs
Workspace ID : <workspace-id>
Authentication type : Azure Active Directory - Universal with MFA support
Account : <az-china-account>
  • Connect, get the following error :
Error: invalid_request occurred when acquiring token.
65002 - [2023-03-24 11:07:48Z]: AADSTS65002: Consent between first party application 'REDACTED' and first party resource 'REDACTED' must be configured via preauthorization - applications owned and operated by Microsoft must get approval from the API owner before requesting tokens for that API.
Trace ID: REDACTED
Correlation ID: REDACTED
Timestamp: 2023-03-24 11:07:48Z - Correlation ID: REDACTED - Trace ID: REDACTED

Does this issue occur when all extensions are disabled?: N/A

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 25 (9 by maintainers)

Most upvoted comments

I had to revert back to version 1.41.3 to get it to work again.

Same problem here, can’t use log analytics in azure data studio… West europe.

The Log Analytics Workspace can not be reached. Please validate the Workspace ID, the correct tenant is selected, and that you have access to the workspace. Error Message: The provided authentication is not valid for this resource

Any workarounds at all ?

Encountering the same with US East - Log Analytics - Public Cloud

System.Exception: The Log Analytics Workspace can not be reached. Please validate the Workspace ID, the correct tenant is selected, and that you have access to the workspace. 
Error Message: The provided authentication is not valid for this resource

   at Microsoft.Kusto.ServiceLayer.DataSource.Monitor.MonitorClient.LoadMetadata(Boolean refresh) in D:\a\1\s\src\Microsoft.Kusto.ServiceLayer\DataSource\Monitor\MonitorClient.cs:line 64
   at Microsoft.Kusto.ServiceLayer.DataSource.Monitor.MonitorIntellisenseClient..ctor(MonitorClient monitorClient) in D:\a\1\s\src\Microsoft.Kusto.ServiceLayer\DataSource\Monitor\MonitorIntellisenseClient.cs:line 17
   at Microsoft.Kusto.ServiceLayer.DataSource.DataSourceFactory.Create(ConnectionDetails connectionDetails, String ownerUri) in D:\a\1\s\src\Microsoft.Kusto.ServiceLayer\DataSource\DataSourceFactory.cs:line 44
   at Microsoft.Kusto.ServiceLayer.Connection.ReliableDataSourceConnection..ctor(ConnectionDetails connectionDetails, RetryPolicy connectionRetryPolicy, RetryPolicy commandRetryPolicy, IDataSourceFactory dataSourceFactory, String ownerUri) in D:\a\1\s\src\Microsoft.Kusto.ServiceLayer\DataSource\ReliableDataSourceConnection.cs:line 65
   at Microsoft.Kusto.ServiceLayer.Connection.DataSourceConnectionFactory.CreateDataSourceConnection(ConnectionDetails connectionDetails, String ownerUri) in D:\a\1\s\src\Microsoft.Kusto.ServiceLayer\Connection\DataSourceConnectionFactory.cs:line 36
   at Microsoft.Kusto.ServiceLayer.Connection.ConnectionService.TryOpenConnection(ConnectionInfo connectionInfo, ConnectParams connectionParams) in D:\a\1\s\src\Microsoft.Kusto.ServiceLayer\Connection\ConnectionService.cs:line 402
Version: 1.46.1 (user setup)
Commit: ba29842b81dec01177415e53948ca2168e69c3f8
Date: 2023-10-02T18:14:22.887Z
VS Code: 1.79.2
Electron: 22.3.25
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Windows_NT x64 10.0.22631

Hello ! Getting the following error :

System.Exception: The Log Analytics Workspace can not be reached. Please validate the Workspace ID, the correct tenant is selected, and that you have access to the workspace. 
Error Message: The provided authentication is not valid for this resource

   at Microsoft.Kusto.ServiceLayer.DataSource.Monitor.MonitorClient.LoadMetadata(Boolean refresh) in D:\a\1\s\src\Microsoft.Kusto.ServiceLayer\DataSource\Monitor\MonitorClient.cs:line 64
   at Microsoft.Kusto.ServiceLayer.DataSource.Monitor.MonitorIntellisenseClient..ctor(MonitorClient monitorClient) in D:\a\1\s\src\Microsoft.Kusto.ServiceLayer\DataSource\Monitor\MonitorIntellisenseClient.cs:line 17
   at Microsoft.Kusto.ServiceLayer.DataSource.DataSourceFactory.Create(ConnectionDetails connectionDetails, String ownerUri) in D:\a\1\s\src\Microsoft.Kusto.ServiceLayer\DataSource\DataSourceFactory.cs:line 44
   at Microsoft.Kusto.ServiceLayer.Connection.ReliableDataSourceConnection..ctor(ConnectionDetails connectionDetails, RetryPolicy connectionRetryPolicy, RetryPolicy commandRetryPolicy, IDataSourceFactory dataSourceFactory, String ownerUri) in D:\a\1\s\src\Microsoft.Kusto.ServiceLayer\DataSource\ReliableDataSourceConnection.cs:line 65
   at Microsoft.Kusto.ServiceLayer.Connection.DataSourceConnectionFactory.CreateDataSourceConnection(ConnectionDetails connectionDetails, String ownerUri) in D:\a\1\s\src\Microsoft.Kusto.ServiceLayer\Connection\DataSourceConnectionFactory.cs:line 36
   at Microsoft.Kusto.ServiceLayer.Connection.ConnectionService.TryOpenConnection(ConnectionInfo connectionInfo, ConnectParams connectionParams) in D:\a\1\s\src\Microsoft.Kusto.ServiceLayer\Connection\ConnectionService.cs:line 402

Hi @ludwhe, yes we are working with the Log Analytics team to get our app pre-authorized, we will let you know once this process is complete.