diff --git a/Dockerfile b/Dockerfile index 4359e0949bb..ab9ce338641 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,8 +39,6 @@ complete -o nospace -F _python_argcomplete \"az\"\n\ " > /etc/az.completion RUN echo "\nsource '/etc/az.completion'\n" >> /etc/bash.bashrc -RUN curl -sSL https://get.docker.com/ | sh - WORKDIR / CMD az; bash diff --git a/src/azure/cli/_azure_env.py b/src/azure/cli/_azure_env.py index c9333fff732..5ae49694fc0 100644 --- a/src/azure/cli/_azure_env.py +++ b/src/azure/cli/_azure_env.py @@ -5,7 +5,9 @@ CLIENT_ID = '04b07795-8ddb-461a-bbee-02f9e1bf7b46' -ENV_DEFAULT = 'dogfood' +ENV_DEFAULT = 'AzureCloud' +ENV_US_GOVERNMENT = 'AzureUSGovernment' +ENV_CHINA = 'AzureChinaCloud' COMMON_TENANT = 'common' @@ -14,16 +16,22 @@ class ENDPOINT_URLS: #pylint: disable=too-few-public-methods,old-style-class,no- MANAGEMENT = 'management' ACTIVE_DIRECTORY_AUTHORITY = 'active_directory_authority' ACTIVE_DIRECTORY_GRAPH_RESOURCE_ID = 'active_directory_graph_resource_id' - RESOURCE_MANAGER = 'resource_manager' - STORAGE_END_POINT_SUFFIX = 'storage end point suffix' _environments = { ENV_DEFAULT: { ENDPOINT_URLS.MANAGEMENT: 'https://management.core.windows.net/', - ENDPOINT_URLS.ACTIVE_DIRECTORY_AUTHORITY : 'https://login.windows-ppe.net', - ENDPOINT_URLS.ACTIVE_DIRECTORY_GRAPH_RESOURCE_ID: 'https://graph.ppe.windows.net/', - ENDPOINT_URLS.RESOURCE_MANAGER: 'https://api-dogfood.resources.windows-int.net/', - ENDPOINT_URLS.STORAGE_END_POINT_SUFFIX: 'blob.core.test-cint.azure-test.net/' + ENDPOINT_URLS.ACTIVE_DIRECTORY_AUTHORITY : 'https://login.microsoftonline.com', + ENDPOINT_URLS.ACTIVE_DIRECTORY_GRAPH_RESOURCE_ID: 'https://graph.windows.net/' + }, + ENV_CHINA: { + ENDPOINT_URLS.MANAGEMENT: 'https://management.core.chinacloudapi.cn/', + ENDPOINT_URLS.ACTIVE_DIRECTORY_AUTHORITY: 'https://login.chinacloudapi.cn', + ENDPOINT_URLS.ACTIVE_DIRECTORY_GRAPH_RESOURCE_ID: 'https://graph.chinacloudapi.cn/' + }, + ENV_US_GOVERNMENT: { + ENDPOINT_URLS.MANAGEMENT: 'https://management.core.usgovcloudapi.net/', + ENDPOINT_URLS.ACTIVE_DIRECTORY_AUTHORITY: 'https://login.microsoftonline.com', + ENDPOINT_URLS.ACTIVE_DIRECTORY_GRAPH_RESOURCE_ID: 'https://graph.windows.net/' } } diff --git a/src/azure/cli/_profile.py b/src/azure/cli/_profile.py index 6a8e9befa3a..c0f3bc977fb 100644 --- a/src/azure/cli/_profile.py +++ b/src/azure/cli/_profile.py @@ -245,7 +245,7 @@ def __init__(self, auth_context_factory, adal_token_cache, arm_client_factory=No self._auth_context_factory = auth_context_factory self.user_id = None # will figure out after log user in self._arm_client_factory = arm_client_factory or \ - (lambda config: SubscriptionClient(config, base_url=get_env()[ENDPOINT_URLS.RESOURCE_MANAGER])) #pylint: disable=unnecessary-lambda + (lambda config: SubscriptionClient(config)) #pylint: disable=unnecessary-lambda def find_from_user_account(self, username, password, resource): context = self._create_auth_context(COMMON_TENANT) diff --git a/src/azure/cli/commands/client_factory.py b/src/azure/cli/commands/client_factory.py index c54504c2e58..a1f6242e44c 100644 --- a/src/azure/cli/commands/client_factory.py +++ b/src/azure/cli/commands/client_factory.py @@ -9,11 +9,6 @@ import azure.cli._logging as _logging from azure.cli.application import APPLICATION -from azure.cli._azure_env import ( - get_env, - ENDPOINT_URLS -) - logger = _logging.get_az_logger(__name__) def get_mgmt_service_client(client_type): @@ -45,7 +40,7 @@ def _get_mgmt_service_client(client_type, subscription_bound=True): profile = Profile() cred, subscription_id, _ = profile.get_login_credentials() if subscription_bound: - client = client_type(cred, subscription_id, base_url=get_env()[ENDPOINT_URLS.RESOURCE_MANAGER]) + client = client_type(cred, subscription_id) else: client = client_type(cred)