Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate azure_germany #37654

Merged
merged 5 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sdk/identity/azure-identity/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

### Other Changes

- Deprecated `AzureAuthorityHosts.AZURE_GERMANY`

## 1.18.0 (2024-09-19)

### Features Added
Expand Down
16 changes: 14 additions & 2 deletions sdk/identity/azure-identity/azure/identity/_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import warnings

DEVELOPER_SIGN_ON_CLIENT_ID = "04b07795-8ddb-461a-bbee-02f9e1bf7b46"
AZURE_VSCODE_CLIENT_ID = "aebc6443-996d-45c2-90f0-388ff96faa56"
Expand All @@ -13,9 +14,20 @@
CACHE_CAE_SUFFIX = ".cae"


class AzureAuthorityHosts:
class AzureAuthorityHostsMeta(type):
def __getattr__(cls, name):
if name == "AZURE_GERMANY":
warnings.warn(
"AZURE_GERMANY is deprecated. Microsoft Cloud Germany was closed on October 29th, 2021.",
DeprecationWarning,
stacklevel=2,
)
return "login.microsoftonline.de"
raise AttributeError(f"{name} not found in {cls.__name__}")


class AzureAuthorityHosts(metaclass=AzureAuthorityHostsMeta):
AZURE_CHINA = "login.chinacloudapi.cn"
AZURE_GERMANY = "login.microsoftonline.de"
AZURE_GOVERNMENT = "login.microsoftonline.us"
AZURE_PUBLIC_CLOUD = "login.microsoftonline.com"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ def _initialize(self, vscode_user_settings: Dict, **kwargs: Any) -> None:
authority = AzureAuthorityHosts.AZURE_PUBLIC_CLOUD
elif self._cloud == "AzureChinaCloud":
authority = AzureAuthorityHosts.AZURE_CHINA
elif self._cloud == "AzureGermanCloud":
authority = AzureAuthorityHosts.AZURE_GERMANY
elif self._cloud == "AzureUSGovernment":
authority = AzureAuthorityHosts.AZURE_GOVERNMENT
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

_DEFAULT_AUTHENTICATE_SCOPES = {
"https://" + KnownAuthorities.AZURE_CHINA: ("https://management.core.chinacloudapi.cn//.default",),
"https://" + KnownAuthorities.AZURE_GERMANY: ("https://management.core.cloudapi.de//.default",),
"https://" + KnownAuthorities.AZURE_GOVERNMENT: ("https://management.core.usgovcloudapi.net//.default",),
"https://" + KnownAuthorities.AZURE_PUBLIC_CLOUD: ("https://management.core.windows.net//.default",),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ def validate_scopes(*scopes, **_):
"authority,expected_scope",
(
(KnownAuthorities.AZURE_CHINA, "https://management.core.chinacloudapi.cn//.default"),
(KnownAuthorities.AZURE_GERMANY, "https://management.core.cloudapi.de//.default"),
(KnownAuthorities.AZURE_GOVERNMENT, "https://management.core.usgovcloudapi.net//.default"),
(KnownAuthorities.AZURE_PUBLIC_CLOUD, "https://management.core.windows.net//.default"),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ def test_custom_cloud_no_authority():
(
("AzureCloud", AzureAuthorityHosts.AZURE_PUBLIC_CLOUD),
("AzureChinaCloud", AzureAuthorityHosts.AZURE_CHINA),
("AzureGermanCloud", AzureAuthorityHosts.AZURE_GERMANY),
("AzureUSGovernment", AzureAuthorityHosts.AZURE_GOVERNMENT),
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ async def test_custom_cloud_no_authority():
(
("AzureCloud", AzureAuthorityHosts.AZURE_PUBLIC_CLOUD),
("AzureChinaCloud", AzureAuthorityHosts.AZURE_CHINA),
("AzureGermanCloud", AzureAuthorityHosts.AZURE_GERMANY),
("AzureUSGovernment", AzureAuthorityHosts.AZURE_GOVERNMENT),
),
)
Expand Down