@@ -76,8 +76,9 @@ def get_auth_provider(cfg: ClientContext):
7676
7777PYSQL_OAUTH_SCOPES = ["sql" ,"offline_access" ]
7878PYSQL_OAUTH_CLIENT_ID = "databricks-sql-python"
79- PYSQL_OAUTH_AZURE_EXPERIMENTAL_CLIENT_ID = "a743d78c-536a-4ffc-b110-edfb231e90dc "
79+ PYSQL_OAUTH_AZURE_CLIENT_ID = "96eecda7-19ea-49cc-abb5-240097d554f5 "
8080PYSQL_OAUTH_REDIRECT_PORT_RANGE = list (range (8020 ,8025 ))
81+ PYSQL_OAUTH_AZURE_REDIRECT_PORT_RANGE = [8030 ]
8182
8283
8384def normalize_host_name (hostname :str ):
@@ -86,15 +87,16 @@ def normalize_host_name(hostname: str):
8687return f"{ maybe_scheme } { hostname } { maybe_trailing_slash } "
8788
8889
89- def get_client_id (hostname :str ):
90+ def get_client_id_and_redirect_port (hostname :str ):
9091return (
91- PYSQL_OAUTH_CLIENT_ID
92+ ( PYSQL_OAUTH_CLIENT_ID , PYSQL_OAUTH_REDIRECT_PORT_RANGE )
9293if infer_cloud_from_host (hostname )== CloudType .AWS
93- else PYSQL_OAUTH_AZURE_EXPERIMENTAL_CLIENT_ID
94+ else ( PYSQL_OAUTH_AZURE_CLIENT_ID , PYSQL_OAUTH_AZURE_REDIRECT_PORT_RANGE )
9495 )
9596
9697
9798def get_python_sql_connector_auth_provider (hostname :str ,** kwargs ):
99+ (client_id ,redirect_port_range )= get_client_id_and_redirect_port (hostname )
98100cfg = ClientContext (
99101hostname = normalize_host_name (hostname ),
100102auth_type = kwargs .get ("auth_type" ),
@@ -104,10 +106,10 @@ def get_python_sql_connector_auth_provider(hostname: str, **kwargs):
104106use_cert_as_auth = kwargs .get ("_use_cert_as_auth" ),
105107tls_client_cert_file = kwargs .get ("_tls_client_cert_file" ),
106108oauth_scopes = PYSQL_OAUTH_SCOPES ,
107- oauth_client_id = kwargs .get ("oauth_client_id" )or get_client_id ( hostname ) ,
109+ oauth_client_id = kwargs .get ("oauth_client_id" )or client_id ,
108110oauth_redirect_port_range = [kwargs ["oauth_redirect_port" ]]
109111if kwargs .get ("oauth_client_id" )and kwargs .get ("oauth_redirect_port" )
110- else PYSQL_OAUTH_REDIRECT_PORT_RANGE ,
112+ else redirect_port_range ,
111113oauth_persistence = kwargs .get ("experimental_oauth_persistence" ),
112114credentials_provider = kwargs .get ("credentials_provider" ),
113115 )