[BUG] Can't authenticate using AZ CLI with Kusto on MacOS (System.PlatformNotSupportedException: Az-Cli does not support the current operting system)
See original GitHub issueLibrary name and version
Kusto.Data 11.0
Describe the bug
I’m facing an issue when trying to authenticate to my ADX cluster in a local C# Azure function using AZ CLI Authentication on MacOS:
Error : System.PlatformNotSupportedException: Az-Cli does not support the current operting system
at Kusto.Cloud.Platform.Security.AzCliTokenProvider.LocateAzCli()
at Kusto.Cloud.Platform.Security.AzCliTokenProvider.GetTokenFromAzCli(String resource, Boolean interactive)
at Kusto.Cloud.Platform.Security.AzCliTokenProvider.GetCredentialsAsync(String targetResource)
at Kusto.Cloud.Platform.Http.TokenProviderHttpClientAuthenticator.AuthenticateAsync(HttpRequestMessage request)
at Kusto.Data.Net.Client.RestClient2.MakeHttpRequestAsyncImpl(String address, String csl, String ns, String databaseName, Boolean streaming, ClientRequestProperties properties, ServiceModelTimeoutKind timeoutKind, String clientRequestId, Stream body, StreamProperties streamProperties, CancellationToken cancellationToken, KustoProtocolRequest request)
at Kusto.Cloud.Platform.Utils.MonitoredActivity.InvokeAsync[TActivityType,TResult](TActivityType activityType, Func`1 func, String clientRequestId)
at Kusto.Cloud.Platform.Utils.MonitoredActivity.InvokeAsync[TActivityType,TResult](TActivityType activityType, Func`1 func, String clientRequestId)
at Kusto.Data.Net.Client.RestClient2.MakeHttpRequestAsync(ActivityType activityType, String baseAddress, String relativeAddress, String clientRequestIdPrefix, String ns, String databaseName, String csl, String addr, Boolean streaming, ClientRequestProperties properties, ServiceModelTimeoutKind timeoutKind, StreamProperties streamProperties, CancellationToken cancellationToken)
at Kusto.Data.Net.Client.RestClient2.ExecuteControlCommandAsync(String databaseName, String command, String addr, ClientRequestProperties properties)
at Kushy.ServerSymbolLoader.ExecuteControlCommandAsync[T](ICslAdminProvider provider, String database, String command, Boolean throwOnError, CancellationToken cancellationToken) in query-parsing-service/SymbolLoader.cs:line 324
at Kushy.ServerSymbolLoader.LoadTablesAsync(ICslAdminProvider provider, String databaseName, Boolean throwOnError, CancellationToken cancellationToken) in /query-parsing-service/SymbolLoader.cs:line 239
at Kushy.ServerSymbolLoader.LoadDatabaseAsync(String databaseName, String clusterName, Boolean throwOnError, CancellationToken cancellationToken) in query-parsing-service/SymbolLoader.cs:line 208
at Company.Function.QueryParsingService.Run(HttpRequest req, ILogger log) in query-parsing-service/QueryParsingService.cs:line 42
Am I missing something? Has the Kusto C# SDK not delivered this feature yet? TIA
Expected behavior
I expected it to behave in the same fashion as in Python. To use the AZ CLI to authenticate with Azure services.
Actual behavior
It’s saying that my current platform (MacOS) is not supported yet. However I find that hard to believe because it works for the Python SDK.
Reproduction Steps
Here’s the code:
public static class QueryParsingService
{
[FunctionName("QueryParsingService")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
ILogger log)
{
var cluster = System.Environment.GetEnvironmentVariable("CLUSTER_ENDPOINT");
var connection = new KustoConnectionStringBuilder(cluster).WithAadAzCliAuthentication(); // here
var server = new ServerSymbolLoader(connection);
try
{
var tableNames = await server.LoadDatabaseAsync("DBName", cluster,true); // the stacktrace points here but the object is instantiated above
}
catch (System.Exception err)
{
System.Console.WriteLine("Error : " + err);
}
responseMessage.Add("tables", "OK");
return new OkObjectResult(responseMessage);
}
Environment
SDK .NET:
Version: 6.0.110
Commit: ce0a42998a
Runtime environment :
OS Name: Mac OS X
OS Version: 12.5
OS Platform: Darwin
RID: osx.12-x64
Base Path: /usr/local/share/dotnet/sdk/6.0.110/
global.json file:
Not found
Host:
Version: 6.0.10
Architecture: x64
Commit: 5a400c212a
.NET SDKs installed:
6.0.110 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.10 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.10 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
IDE-wise, I’m using VSCode:
1.62.2
3a6960b964327f0e3882ce18fcebd07ed191b316
x64
Issue Analytics
- State:
- Created a year ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Az-Cli does not support the current operating system ...
I'm facing an issue when trying to authenticate to my ADX cluster using AZ CLI Authentication on MacOS: Error : System.
Read more >Install the Azure CLI on macOS
Learn how to install and run the Azure CLI on macOS using the homebrew package manager. The Azure CLI has been tested on...
Read more >How to Install Azure CLI (Windows, Linux, macOS ...
Learn how to install Azure CLI on any operating system you have including how to get started using it in the Azure Shell!...
Read more >Authenticating via the Azure CLI | Guides | hashicorp/azurerm
Authenticating via the Azure CLI is only supported when using a User Account. If you're using a Service Principal (for example via az...
Read more >How to install and experiment with Azure CLI on macOS
In this video, learn how to install and configure Azure command line interface ( CLI ) on macOS. We'll also take a look...
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 FreeTop 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
Top GitHub Comments
@FaresKi Thanks for your reply. I am still investigating and discussing this with the Product Owners. I will get back to you once I have more details on this. We appreciate your patience on this.
@FaresKi Apologies for the late reply. Thanks for reaching out to us and reporting this issue. We are looking into this issue and we will provide an update.