Skip to content

Commit 37a2e61

Browse files
xiangyan99pvaneck
andauthored
deprecate azure_germany (#37654)
* deprecate azure_germany * update * update * Update sdk/identity/azure-identity/azure/identity/_constants.py Co-authored-by: Paul Van Eck <[email protected]> * update --------- Co-authored-by: Paul Van Eck <[email protected]>
1 parent b5792ad commit 37a2e61

File tree

7 files changed

+16
-8
lines changed

7 files changed

+16
-8
lines changed

sdk/identity/azure-identity/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
### Other Changes
1414

15+
- Deprecated `AzureAuthorityHosts.AZURE_GERMANY`
16+
1517
## 1.18.0 (2024-09-19)
1618

1719
### Features Added

sdk/identity/azure-identity/azure/identity/_constants.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Copyright (c) Microsoft Corporation.
33
# Licensed under the MIT License.
44
# ------------------------------------
5+
import warnings
56

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

1516

16-
class AzureAuthorityHosts:
17+
class AzureAuthorityHostsMeta(type):
18+
def __getattr__(cls, name):
19+
if name == "AZURE_GERMANY":
20+
warnings.warn(
21+
"AZURE_GERMANY is deprecated. Microsoft Cloud Germany was closed on October 29th, 2021.",
22+
DeprecationWarning,
23+
stacklevel=2,
24+
)
25+
return "login.microsoftonline.de"
26+
raise AttributeError(f"{name} not found in {cls.__name__}")
27+
28+
29+
class AzureAuthorityHosts(metaclass=AzureAuthorityHostsMeta):
1730
AZURE_CHINA = "login.chinacloudapi.cn"
18-
AZURE_GERMANY = "login.microsoftonline.de"
1931
AZURE_GOVERNMENT = "login.microsoftonline.us"
2032
AZURE_PUBLIC_CLOUD = "login.microsoftonline.com"
2133

sdk/identity/azure-identity/azure/identity/_credentials/vscode.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ def _initialize(self, vscode_user_settings: Dict, **kwargs: Any) -> None:
7777
authority = AzureAuthorityHosts.AZURE_PUBLIC_CLOUD
7878
elif self._cloud == "AzureChinaCloud":
7979
authority = AzureAuthorityHosts.AZURE_CHINA
80-
elif self._cloud == "AzureGermanCloud":
81-
authority = AzureAuthorityHosts.AZURE_GERMANY
8280
elif self._cloud == "AzureUSGovernment":
8381
authority = AzureAuthorityHosts.AZURE_GOVERNMENT
8482
else:

sdk/identity/azure-identity/azure/identity/_internal/interactive.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
_DEFAULT_AUTHENTICATE_SCOPES = {
2929
"https://" + KnownAuthorities.AZURE_CHINA: ("https://management.core.chinacloudapi.cn//.default",),
30-
"https://" + KnownAuthorities.AZURE_GERMANY: ("https://management.core.cloudapi.de//.default",),
3130
"https://" + KnownAuthorities.AZURE_GOVERNMENT: ("https://management.core.usgovcloudapi.net//.default",),
3231
"https://" + KnownAuthorities.AZURE_PUBLIC_CLOUD: ("https://management.core.windows.net//.default",),
3332
}

sdk/identity/azure-identity/tests/test_interactive_credential.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ def validate_scopes(*scopes, **_):
183183
"authority,expected_scope",
184184
(
185185
(KnownAuthorities.AZURE_CHINA, "https://management.core.chinacloudapi.cn//.default"),
186-
(KnownAuthorities.AZURE_GERMANY, "https://management.core.cloudapi.de//.default"),
187186
(KnownAuthorities.AZURE_GOVERNMENT, "https://management.core.usgovcloudapi.net//.default"),
188187
(KnownAuthorities.AZURE_PUBLIC_CLOUD, "https://management.core.windows.net//.default"),
189188
),

sdk/identity/azure-identity/tests/test_vscode_credential.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ def test_custom_cloud_no_authority():
256256
(
257257
("AzureCloud", AzureAuthorityHosts.AZURE_PUBLIC_CLOUD),
258258
("AzureChinaCloud", AzureAuthorityHosts.AZURE_CHINA),
259-
("AzureGermanCloud", AzureAuthorityHosts.AZURE_GERMANY),
260259
("AzureUSGovernment", AzureAuthorityHosts.AZURE_GOVERNMENT),
261260
),
262261
)

sdk/identity/azure-identity/tests/test_vscode_credential_async.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ async def test_custom_cloud_no_authority():
244244
(
245245
("AzureCloud", AzureAuthorityHosts.AZURE_PUBLIC_CLOUD),
246246
("AzureChinaCloud", AzureAuthorityHosts.AZURE_CHINA),
247-
("AzureGermanCloud", AzureAuthorityHosts.AZURE_GERMANY),
248247
("AzureUSGovernment", AzureAuthorityHosts.AZURE_GOVERNMENT),
249248
),
250249
)

0 commit comments

Comments
 (0)