77# --------------------------------------------------------------------------
88
99from copy import deepcopy
10- from typing import Any , TYPE_CHECKING
10+ from typing import Any , Optional , TYPE_CHECKING , cast
1111from typing_extensions import Self
1212
1313from azure .core .pipeline import policies
1414from azure .core .rest import HttpRequest , HttpResponse
15+ from azure .core .settings import settings
1516from azure .mgmt .core import ARMPipelineClient
1617from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
18+ from azure .mgmt .core .tools import get_arm_endpoints
1719
1820from . import models as _models
1921from ._configuration import KustoManagementClientConfiguration
20- from ._serialization import Deserializer , Serializer
22+ from ._utils . serialization import Deserializer , Serializer
2123from .operations import (
2224 AttachedDatabaseConfigurationsOperations ,
2325 ClusterPrincipalAssignmentsOperations ,
@@ -88,7 +90,7 @@ class KustoManagementClient: # pylint: disable=too-many-instance-attributes
8890 :type credential: ~azure.core.credentials.TokenCredential
8991 :param subscription_id: The ID of the target subscription. Required.
9092 :type subscription_id: str
91- :param base_url: Service URL. Default value is "https://management.azure.com" .
93+ :param base_url: Service URL. Default value is None .
9294 :type base_url: str
9395 :keyword api_version: Api Version. Default value is "2024-04-13". Note that overriding this
9496 default value may result in unsupported behavior.
@@ -98,15 +100,17 @@ class KustoManagementClient: # pylint: disable=too-many-instance-attributes
98100 """
99101
100102 def __init__ (
101- self ,
102- credential : "TokenCredential" ,
103- subscription_id : str ,
104- base_url : str = "https://management.azure.com" ,
105- ** kwargs : Any
103+ self , credential : "TokenCredential" , subscription_id : str , base_url : Optional [str ] = None , ** kwargs : Any
106104 ) -> None :
105+ _cloud = kwargs .pop ("cloud_setting" , None ) or settings .current .azure_cloud # type: ignore
106+ _endpoints = get_arm_endpoints (_cloud )
107+ if not base_url :
108+ base_url = _endpoints ["resource_manager" ]
109+ credential_scopes = kwargs .pop ("credential_scopes" , _endpoints ["credential_scopes" ])
107110 self ._config = KustoManagementClientConfiguration (
108- credential = credential , subscription_id = subscription_id , ** kwargs
111+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
109112 )
113+
110114 _policies = kwargs .pop ("policies" , None )
111115 if _policies is None :
112116 _policies = [
@@ -125,7 +129,7 @@ def __init__(
125129 policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
126130 self ._config .http_logging_policy ,
127131 ]
128- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
132+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = cast ( str , base_url ) , policies = _policies , ** kwargs )
129133
130134 client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
131135 self ._serialize = Serializer (client_models )
0 commit comments