diff --git a/sdk/core/azure-core/CHANGELOG.md b/sdk/core/azure-core/CHANGELOG.md index 51c5c9641824..e8312e2c08bc 100644 --- a/sdk/core/azure-core/CHANGELOG.md +++ b/sdk/core/azure-core/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.32.0 (Unreleased) +## 1.32.0 (2024-10-31) ### Features Added diff --git a/sdk/core/azure-mgmt-core/CHANGELOG.md b/sdk/core/azure-mgmt-core/CHANGELOG.md index 4ee21c3b8c89..f83890f3b1d8 100644 --- a/sdk/core/azure-mgmt-core/CHANGELOG.md +++ b/sdk/core/azure-mgmt-core/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 1.5.0 (2024-10-31) + +### Features Added + +- Added helper function `get_arm_endpoints` to get the ARM endpoint and credential scopes from the cloud setting. + ## 1.4.0 (2023-04-06) ### Features diff --git a/sdk/core/azure-mgmt-core/azure/mgmt/core/_version.py b/sdk/core/azure-mgmt-core/azure/mgmt/core/_version.py index 09b920aeeec0..1948e34ac9b0 100644 --- a/sdk/core/azure-mgmt-core/azure/mgmt/core/_version.py +++ b/sdk/core/azure-mgmt-core/azure/mgmt/core/_version.py @@ -9,4 +9,4 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "1.4.0" +VERSION = "1.5.0" diff --git a/sdk/core/azure-mgmt-core/azure/mgmt/core/tools.py b/sdk/core/azure-mgmt-core/azure/mgmt/core/tools.py index 06df8af9c168..2143a5e516ae 100644 --- a/sdk/core/azure-mgmt-core/azure/mgmt/core/tools.py +++ b/sdk/core/azure-mgmt-core/azure/mgmt/core/tools.py @@ -23,9 +23,10 @@ # IN THE SOFTWARE. # # -------------------------------------------------------------------------- -from typing import Mapping, MutableMapping, Optional, Type, Union, cast +from typing import Mapping, MutableMapping, Optional, Type, Union, cast, Dict, Any import re import logging +from azure.core import AzureClouds _LOGGER = logging.getLogger(__name__) @@ -217,3 +218,29 @@ def is_valid_resource_name(rname: str, exception_type: Optional[Type[BaseExcepti if exception_type: raise exception_type() return False + + +def get_arm_endpoints(cloud_setting: AzureClouds) -> Dict[str, Any]: + """Get the ARM endpoint and ARM credential scopes for the given cloud setting. + + :param cloud_setting: The cloud setting for which to get the ARM endpoint. + :type cloud_setting: AzureClouds + :return: The ARM endpoint and ARM credential scopes. + :rtype: dict[str, Any] + """ + if cloud_setting == AzureClouds.AZURE_CHINA_CLOUD: + return { + "resource_manager": "https://management.chinacloudapi.cn", + "credential_scopes": ["https://management.chinacloudapi.cn/.default"], + } + if cloud_setting == AzureClouds.AZURE_US_GOVERNMENT: + return { + "resource_manager": "https://management.usgovcloudapi.net/", + "credential_scopes": ["https://management.core.usgovcloudapi.net/.default"], + } + if cloud_setting == AzureClouds.AZURE_PUBLIC_CLOUD: + return { + "resource_manager": "https://management.azure.com/", + "credential_scopes": ["https://management.azure.com/.default"], + } + raise ValueError("Unknown cloud setting: {}".format(cloud_setting)) diff --git a/sdk/core/azure-mgmt-core/setup.py b/sdk/core/azure-mgmt-core/setup.py index f89e829c6a42..5203a92c70ea 100644 --- a/sdk/core/azure-mgmt-core/setup.py +++ b/sdk/core/azure-mgmt-core/setup.py @@ -69,7 +69,7 @@ "pytyped": ["py.typed"], }, install_requires=[ - "azure-core>=1.29.0", + "azure-core>=1.31.0", ], python_requires=">=3.8", )