Skip to content

KustoConnectionStringBuilder does not deserialize "msi authentication" and "msi params" correctly #439

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
creste opened this issue Dec 2, 2022 · 1 comment · Fixed by #440
Assignees

Comments

@creste
Copy link
Contributor

creste commented Dec 2, 2022

Code Sample, a copy-pastable example if possible

This code:

kcsb = KustoConnectionStringBuilder.with_aad_managed_service_identity_authentication(
        connection_string=connection_string,
        client_id=client_id)
connection_string = str(kcsb)
client = KustoClient(connection_string)

Throws this exception:

KeyError: 'msi authentication'

Problem description

KustoConnectionStringBuilder serializes ValidKeywords.msi_auth and ValidKeywords.msi_params using these keys:

  • MSI Authentication
  • MSI Params

See:

msi_auth = "MSI Authentication"
msi_params = "MSI Params"

When deserializing, only these keys are allowed:

  • msi_auth
  • msi_params

See:

if key in ["msi_auth"]:
return cls.msi_auth
if key in ["msi_type"]:
return cls.msi_params

This fixes the problem:

diff --git a/azure-kusto-data/azure/kusto/data/kcsb.py b/azure-kusto-data/azure/kusto/data/kcsb.py
index 3289964..b7a9a87 100644
--- a/azure-kusto-data/azure/kusto/data/kcsb.py
+++ b/azure-kusto-data/azure/kusto/data/kcsb.py
@@ -65,9 +65,9 @@ class KustoConnectionStringBuilder:
                 return cls.application_token
             if key in ["user token", "usertoken", "usrtoken"]:
                 return cls.user_token
-            if key in ["msi_auth"]:
+            if key in ["msi_auth", "msi authentication"]:
                 return cls.msi_auth
-            if key in ["msi_type"]:
+            if key in ["msi_params", "msi params"]:
                 return cls.msi_params
             if key in ["az cli"]:
                 return cls.az_cli

Output of pip freeze

[paste the output of pip freeze here below this line]

creste added a commit to creste/azure-kusto-python that referenced this issue Dec 2, 2022
…msi authentication" and "msi params" correctly
@AsafMah AsafMah self-assigned this Dec 13, 2022
AsafMah pushed a commit that referenced this issue Dec 14, 2022
…uthentication" and "msi params" correctly (#440)

Fixes #439
@AsafMah
Copy link
Collaborator

AsafMah commented Dec 15, 2022

Released in 4.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants