88# --------------------------------------------------------------------------
99
1010from copy import deepcopy
11- from typing import Any , TYPE_CHECKING
11+ from typing import Any , Optional , TYPE_CHECKING , cast
1212from typing_extensions import Self
1313
1414from azure .core .pipeline import policies
1515from azure .core .rest import HttpRequest , HttpResponse
16+ from azure .core .settings import settings
1617from azure .mgmt .core import ARMPipelineClient
1718from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
19+ from azure .mgmt .core .tools import get_arm_endpoints
1820
1921from . import models as _models
2022from ._configuration import NetworkManagementClientConfiguration
@@ -565,22 +567,24 @@ class NetworkManagementClient(
565567 :param subscription_id: The subscription credentials which uniquely identify the Microsoft
566568 Azure subscription. The subscription ID forms part of the URI for every service call. Required.
567569 :type subscription_id: str
568- :param base_url: Service URL. Default value is "https://management.azure.com" .
570+ :param base_url: Service URL. Default value is None .
569571 :type base_url: str
570572 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
571573 Retry-After header is present.
572574 """
573575
574576 def __init__ (
575- self ,
576- credential : "TokenCredential" ,
577- subscription_id : str ,
578- base_url : str = "https://management.azure.com" ,
579- ** kwargs : Any
577+ self , credential : "TokenCredential" , subscription_id : str , base_url : Optional [str ] = None , ** kwargs : Any
580578 ) -> None :
579+ _cloud = kwargs .pop ("cloud_setting" , None ) or settings .current .azure_cloud # type: ignore
580+ _endpoints = get_arm_endpoints (_cloud )
581+ if not base_url :
582+ base_url = _endpoints ["resource_manager" ]
583+ credential_scopes = kwargs .pop ("credential_scopes" , _endpoints ["credential_scopes" ])
581584 self ._config = NetworkManagementClientConfiguration (
582- credential = credential , subscription_id = subscription_id , ** kwargs
585+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
583586 )
587+
584588 _policies = kwargs .pop ("policies" , None )
585589 if _policies is None :
586590 _policies = [
@@ -599,7 +603,7 @@ def __init__(
599603 policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
600604 self ._config .http_logging_policy ,
601605 ]
602- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
606+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = cast ( str , base_url ) , policies = _policies , ** kwargs )
603607
604608 client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
605609 self ._serialize = Serializer (client_models )
0 commit comments