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 4 years ago
  • Comments: 28 (1 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 ?

Same thing on 1.49.1. “1-Azure Accounts.log” looks like this:

[Verbose]: Initialized Azure account extension storage. - []
[Verbose]: FileEncryptionHelper: Fired encryption keys updated event. - []
[Verbose]: Initializing stored accounts [] - []
[Information]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Info - getTokenCache called - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - getAllAccounts called - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Deserializing JSON to in-memory cache - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Reading cache snapshot from disk - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Overlaying input cache with the default cache - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Setting in-memory cache - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Setting cache key value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Retrieving all cache keys - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Retrieving all cache keys - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Retrieving all cache keys - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Retrieving all cache keys - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Retrieving all cache keys - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Retrieving all cache keys - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Retrieving all cache keys - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Retrieving all cache keys - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Retrieving all cache keys - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Retrieving all cache keys - []
[Verbose]: [Thu, 03 Oct 2024 13:17:09 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Information]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Info - getTokenCache called - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - getAllAccounts called - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Deserializing JSON to in-memory cache - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Reading cache snapshot from disk - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Overlaying input cache with the default cache - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Setting in-memory cache - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Setting cache key value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Retrieving all cache keys - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Retrieving all cache keys - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Retrieving all cache keys - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Retrieving all cache keys - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Retrieving all cache keys - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Retrieving all cache keys - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Retrieving all cache keys - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Retrieving all cache keys - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Retrieving all cache keys - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Retrieving all cache keys - []
[Verbose]: [Thu, 03 Oct 2024 13:17:27 GMT] : @azure/msal-node@1.16.0 : Trace - Getting cache key-value store - []

I’ve the same issue connecting to Log Analytics after upgrading to the latest version: Version: 1.44.1 (user setup) Commit: 8f53a31 Date: 2023-06-01T02:12:48.765Z VS Code: 1.70.0 Electron: 19.1.8 Chromium: 102.0.5005.167 Node.js: 16.14.2 V8: 10.2.154.15-electron.0 OS: Windows_NT x64 10.0.19044

Hello, some good news regarding this: had to setup Data Studio on a new computer, after updating to 1.44.0 on the new install, connecting to Data Explorer works ! Thank you for the work on this 😄 Connecting to Log Aalytics however does not :

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

I am also having this issue. Im using version 1.48.0

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.