Azure / pykusto

Query Kusto like a pro from the comfort of your Jupyter notebook

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exception from _get_azure_cli_auth_token() is not caught.

micky-amir opened this issue · comments

when not logged through az login, _get_azure_cli_auth_token() throws an expectation that is not caught. The message is pretty clear, it requires to run az login. Do we want to keep this behavior? or to have a fallback with the 2FA (what happens when if stored_token is None:)?
stack trace:
File "/Users/amirbenami/Projects/mcasdslib/console_test_env/lib/python3.8/site-packages/pykusto/client.py", line 78, in __init__ self.__client = (self._cached_get_client_for_cluster if use_global_cache else self._get_client_for_cluster)(client_or_cluster) File "/Users/amirbenami/Projects/mcasdslib/console_test_env/lib/python3.8/site-packages/pykusto/client.py", line 122, in _get_client_for_cluster stored_token = _get_azure_cli_auth_token() File "/Users/amirbenami/Projects/mcasdslib/console_test_env/lib/python3.8/site-packages/azure/kusto/data/security.py", line 34, in _get_azure_cli_auth_token token_data = profile.get_raw_token()[0][2] File "/Users/amirbenami/Projects/mcasdslib/console_test_env/lib/python3.8/site-packages/azure/cli/core/_profile.py", line 626, in get_raw_token account = self.get_subscription(subscription) File "/Users/amirbenami/Projects/mcasdslib/console_test_env/lib/python3.8/site-packages/azure/cli/core/_profile.py", line 503, in get_subscription raise CLIError(_AZ_LOGIN_MESSAGE) knack.util.CLIError: Please run 'az login' to setup account.

I think we should fallback to the device authentication. However this might become obsolete after #110 is resolved.