Skip to content

Use DefaultAzureCredential for authenticate #406

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

Closed
christinawongit opened this issue Jul 24, 2022 · 4 comments
Closed

Use DefaultAzureCredential for authenticate #406

christinawongit opened this issue Jul 24, 2022 · 4 comments

Comments

@christinawongit
Copy link

christinawongit commented Jul 24, 2022

from azure.kusto.data import KustoConnectionStringBuilder

It is great to have different authenticate approaches for azure.kusto. However, it is quite tricky to switch between non-prod and prod environments.

For example, the scenario is to communicate with the other Azure resources (e.g. container app and azure data explorer) within the same tenant and the chosen authentication approach is managed identity. During development phase, the developers are working on their local machine and logged in with their own user accounts. So, would it mean they need to switch between embed user name and password in code, and switch to managed identity at deployment stage (would it mean user has to either make change in code every time or need to store unnecessary credential in Production environment)?

I understand we can use service principal (SPN), but the target resources of SPN seems to be third-party service provider (e.g. GitHub) and secret rotation is necessary. So, it would be my personal last preference in this case.

Therefore, would Your Team consider to use Azure.identity.DefaultAzureCredential for authentication?

@yogilad
Copy link
Contributor

yogilad commented Jul 26, 2022

Hi @christinawongit ,

You can use any Azure Identity TokenCredential in combination with kcsb.with_token_provider().
The token value (string) should be passed as the result of a lambda function given to with_token_provider().
The resource string passed to the GetToken Api should be "https://kusto.kusto.windows.net/.default" (assuming you run in public cloud).

@yogilad
Copy link
Contributor

yogilad commented Jul 26, 2022

Keeping this open as a backlog item to add explicit support for kcsb.with_azure_token_credential()

@mpicard
Copy link

mpicard commented Dec 19, 2022

I would also be interested in using DefaultAzureCredential or better support in general for azure.identity TokenCredentials for kusto

@AsafMah
Copy link
Collaborator

AsafMah commented Feb 12, 2023

Since 4.1.0 there is an option to use any TokenCredential class, including DefaultAzureCredential.

@AsafMah AsafMah closed this as completed Feb 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants