Interactive Login Error - Found no browser in current environment
vishnu1729 opened this issue · 1 comments
vishnu1729 commented
I am trying to read a kusto table using the python sdk but it is not succeeding.
The code block is as below:
from azure.kusto.data import KustoClient, KustoConnectionStringBuilder
from azure.kusto.data.helpers import dataframe_from_result_table
cluster = "https://help.kusto.windows.net"
db = "Samples"
query = """
StormEvents
| summarize count() by EventType
| top 5 by count_
"""
kcsb = KustoConnectionStringBuilder.with_interactive_login(cluster)
client = KustoClient(kcsb)
response = client.execute(db, query)
df = dataframe_from_result_table(response.primary_results[0])
This gives me the following error or message
Found no browser in current environment. If this program is being run inside a container which has access to host network (i.e. started by `docker run --net=host -it ...`), you can use browser on host to visit the following link. Otherwise, this auth attempt would either timeout (current timeout setting is None) or be aborted by CTRL+C. Auth URI: https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize?client_id=db662dc1-0cfe-4e1c-a843-19a68e65be58&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A35995&scope=https%3A%2F%2Fkusto.kusto.windows.net%2F.default+offline_access+openid+profile&state=YCTpQyWclLOxVSHM&code_challenge=3k66jxvxTlJrm8Co3zz3-cJDeXm_1aP_NZmFwUJyNfQ&code_challenge_method=S256&nonce=6f2dca38940a15cac7e9f043de09f82449a262228131f69192c7b5600b8bc404&client_info=1&prompt=select_account
When i click on the link, it asks me to select the AAD account to sign in but then fails with localhost refused to connect
. This is the first time I am seeing this issue.
Please see attached screenshots. I am able to run the same query using the dataexplorer web UI.
Please advise on how i can resolve this issue.
vishnu1729 commented
I switched to kcsb = KustoConnectionStringBuilder.with_aad_device_authentication(cluster)
and it worked as intended (prompting to log in with a one time code).
Closing this issue.