forked from Azure/azure-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into acquisition-pip
# Conflicts: # setup.py # src/azure/cli/tests/test_commands.py # src/command_modules/azure-cli-profile/azure/cli/command_modules/profile/account.py # src/command_modules/azure-cli-profile/azure/cli/command_modules/profile/login.py
- Loading branch information
Showing
12 changed files
with
632 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
CLIENT_ID = '04b07795-8ddb-461a-bbee-02f9e1bf7b46' | ||
|
||
ENV_DEFAULT = 'AzureCloud' | ||
ENV_US_GOVERNMENT = 'AzureUSGovernment' | ||
ENV_CHINA = 'AzureChinaCloud' | ||
|
||
COMMON_TENANT = 'common' | ||
|
||
#ported from https://github.com/Azure/azure-xplat-cli/blob/dev/lib/util/profile/environment.js | ||
class ENDPOINT_URLS: #pylint: disable=too-few-public-methods,old-style-class,no-init | ||
MANAGEMENT = 'management' | ||
ACTIVE_DIRECTORY_AUTHORITY = 'active_directory_authority' | ||
|
||
_environments = { | ||
ENV_DEFAULT: { | ||
ENDPOINT_URLS.MANAGEMENT: 'https://management.core.windows.net/', | ||
ENDPOINT_URLS.ACTIVE_DIRECTORY_AUTHORITY : 'https://login.microsoftonline.com' | ||
}, | ||
ENV_CHINA: { | ||
ENDPOINT_URLS.MANAGEMENT: 'https://management.core.chinacloudapi.cn/', | ||
ENDPOINT_URLS.ACTIVE_DIRECTORY_AUTHORITY: 'https://login.chinacloudapi.cn' | ||
}, | ||
ENV_US_GOVERNMENT: { | ||
ENDPOINT_URLS.MANAGEMENT: 'https://management.core.usgovcloudapi.net/', | ||
ENDPOINT_URLS.ACTIVE_DIRECTORY_AUTHORITY: 'https://login.microsoftonline.com' | ||
} | ||
} | ||
|
||
def get_env(env_name=None): | ||
if env_name is None: | ||
env_name = ENV_DEFAULT | ||
elif env_name not in _environments: | ||
raise ValueError | ||
return _environments[env_name] | ||
|
||
def get_authority_url(tenant=None, env_name=None): | ||
env = get_env(env_name) | ||
return env[ENDPOINT_URLS.ACTIVE_DIRECTORY_AUTHORITY] + '/' + (tenant or COMMON_TENANT) | ||
|
||
def get_management_endpoint_url(env_name=None): | ||
env = get_env(env_name) | ||
return env[ENDPOINT_URLS.MANAGEMENT] | ||
|
Oops, something went wrong.