Skip to content
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
1 change: 0 additions & 1 deletion azure-pipelines-full-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ variables:
- template: ${{ variables.Pipeline.Workspace }}/.azure-pipelines/templates/variables.yml

jobs:

- job: AutomationFullTestPython39ProfileLatest
displayName: Automation Full Test Python39 Profile Latest
timeoutInMinutes: 9999
Expand Down
10 changes: 0 additions & 10 deletions src/azure-cli-core/azure/cli/core/_breaking_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,3 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# pylint: disable=line-too-long

from azure.cli.core.breaking_change import AzCLIOtherChange, register_conditional_breaking_change

register_conditional_breaking_change(
tag='CloudProfilesDeprecate',
breaking_change=AzCLIOtherChange(
cmd='',
message="Starting from 2.73.0, the azure stack profiles ('2017-03-09-profile', '2018-03-01-hybrid', '2019-03-01-hybrid', '2020-09-01-hybrid') will be deprecated. Please use the 'latest' profile or the CLI 2.66.* (LTS) version instead."
)
)
14 changes: 13 additions & 1 deletion src/azure-cli-core/azure/cli/core/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,19 @@ def get_clouds(cli_ctx):
# If profile isn't set, use latest
setattr(c, 'profile', 'latest')
if c.profile not in API_PROFILES:
raise CLIError('Profile {} does not exist or is not supported.'.format(c.profile))
if c.profile in (
"2017-03-09-profile",
"2018-03-01-hybrid",
"2019-03-01-hybrid",
"2020-09-01-hybrid",
):
logger.error(
"The azure stack profile '%s' has been deprecated and removed, using the 'latest' profile instead.\n"
"To continue using Azure Stack, please install the Azure CLI `2.66.*` (LTS) version. For more details, refer to: https://learn.microsoft.com/en-us/cli/azure/whats-new-overview#important-notice-for-azure-stack-hub-customers", c.profile
)
c.profile = 'latest'
else:
raise CLIError('Profile {} does not exist or is not supported.'.format(c.profile))
if not c.endpoints.has_endpoint_set('management') and \
c.endpoints.has_endpoint_set('resource_manager'):
# If management endpoint not set, use resource manager endpoint
Expand Down
4 changes: 0 additions & 4 deletions src/azure-cli-core/azure/cli/core/profiles/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ def get_sdk(cli_ctx, resource_type, *attr_args, **kwargs):
# API Profiles currently supported in the CLI.
API_PROFILES = {
'latest': AZURE_API_PROFILES['latest'],
'2017-03-09-profile': AZURE_API_PROFILES['2017-03-09-profile'],
'2018-03-01-hybrid': AZURE_API_PROFILES['2018-03-01-hybrid'],
'2019-03-01-hybrid': AZURE_API_PROFILES['2019-03-01-hybrid'],
'2020-09-01-hybrid': AZURE_API_PROFILES['2020-09-01-hybrid']
}


Expand Down
154 changes: 4 additions & 150 deletions src/azure-cli-core/azure/cli/core/profiles/_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,163 +263,17 @@ def default_api_version(self):
ResourceType.MGMT_CUSTOMLOCATION: '2021-03-15-preview',
ResourceType.MGMT_CONTAINERSERVICE: SDKProfile('2025-02-01'),
ResourceType.MGMT_APPCONTAINERS: '2022-10-01',
},
'2020-09-01-hybrid': {
ResourceType.MGMT_STORAGE: '2019-06-01',
ResourceType.MGMT_NETWORK: '2018-11-01',
ResourceType.MGMT_COMPUTE: SDKProfile('2020-06-01', {
'resource_skus': '2019-04-01',
'disks': '2019-07-01',
'disk_encryption_sets': '2019-07-01',
'disk_accesses': '2020-05-01',
'snapshots': '2019-07-01',
'galleries': '2019-12-01',
'gallery_images': '2019-12-01',
'gallery_image_versions': '2019-12-01',
'virtual_machine_scale_sets': '2020-06-01'
}),
ResourceType.MGMT_KEYVAULT: '2016-10-01',
ResourceType.MGMT_MSI: '2018-11-30',
ResourceType.MGMT_RESOURCE_FEATURES: '2021-07-01',
ResourceType.MGMT_RESOURCE_LINKS: '2016-09-01',
ResourceType.MGMT_RESOURCE_LOCKS: '2016-09-01',
ResourceType.MGMT_RESOURCE_POLICY: '2016-12-01',
ResourceType.MGMT_RESOURCE_RESOURCES: '2019-10-01',
ResourceType.MGMT_RESOURCE_SUBSCRIPTIONS: '2016-06-01',
ResourceType.MGMT_RESOURCE_TEMPLATESPECS: '2015-01-01',
ResourceType.MGMT_RESOURCE_PRIVATELINKS: '2020-05-01',
ResourceType.MGMT_RESOURCE_MANAGEDAPPLICATIONS: '2019-07-01',
ResourceType.MGMT_NETWORK_DNS: '2016-04-01',
ResourceType.MGMT_AUTHORIZATION: SDKProfile('2015-07-01', {
'policy_assignments': '2016-12-01',
'policy_definitions': '2016-12-01'
}),
# The order does make things different.
# Please keep ResourceType.DATA_KEYVAULT_KEYS before ResourceType.DATA_KEYVAULT
ResourceType.DATA_KEYVAULT_CERTIFICATES: None,
ResourceType.DATA_KEYVAULT_KEYS: None,
ResourceType.DATA_KEYVAULT_SECRETS: None,
ResourceType.DATA_STORAGE: '2018-11-09',
ResourceType.DATA_STORAGE_BLOB: '2019-07-07',
ResourceType.DATA_STORAGE_FILEDATALAKE: '2019-07-07',
ResourceType.DATA_STORAGE_FILESHARE: '2019-07-07',
ResourceType.DATA_STORAGE_QUEUE: '2019-07-07',
ResourceType.DATA_COSMOS_TABLE: '2017-04-17',
ResourceType.MGMT_APPSERVICE: '2018-02-01',
ResourceType.MGMT_EVENTHUB: '2022-01-01-preview',
ResourceType.MGMT_SERVICEBUS: '2022-10-01-preview',
ResourceType.MGMT_IOTHUB: '2019-07-01-preview',
ResourceType.MGMT_DATABOXEDGE: '2019-08-01',
ResourceType.MGMT_CONTAINERREGISTRY: '2019-05-01',
ResourceType.MGMT_CONTAINERSERVICE: SDKProfile('2020-11-01', {
'container_services': '2017-07-01',
'open_shift_managed_clusters': '2019-09-30-preview'
})
},
'2019-03-01-hybrid': {
ResourceType.MGMT_STORAGE: '2017-10-01',
ResourceType.MGMT_NETWORK: '2017-10-01',
ResourceType.MGMT_COMPUTE: SDKProfile('2017-12-01', {
'resource_skus': '2017-09-01',
'disks': '2017-03-30',
'snapshots': '2017-03-30'
}),
ResourceType.MGMT_MSI: '2018-11-30',
ResourceType.MGMT_RESOURCE_LINKS: '2016-09-01',
ResourceType.MGMT_RESOURCE_LOCKS: '2016-09-01',
ResourceType.MGMT_RESOURCE_POLICY: '2016-12-01',
ResourceType.MGMT_RESOURCE_RESOURCES: '2018-05-01',
ResourceType.MGMT_RESOURCE_SUBSCRIPTIONS: '2016-06-01',
ResourceType.MGMT_RESOURCE_TEMPLATESPECS: '2015-01-01',
ResourceType.MGMT_RESOURCE_PRIVATELINKS: '2020-05-01',
ResourceType.MGMT_RESOURCE_MANAGEDAPPLICATIONS: '2019-07-01',
ResourceType.MGMT_NETWORK_DNS: '2016-04-01',
ResourceType.MGMT_KEYVAULT: '2016-10-01',
ResourceType.MGMT_AUTHORIZATION: SDKProfile('2015-07-01', {
'policy_assignments': '2016-12-01',
'policy_definitions': '2016-12-01'
}),
# The order does make things different.
# Please keep ResourceType.DATA_KEYVAULT_KEYS before ResourceType.DATA_KEYVAULT
ResourceType.DATA_KEYVAULT_CERTIFICATES: None,
ResourceType.DATA_KEYVAULT_KEYS: None,
ResourceType.DATA_KEYVAULT_SECRETS: None,
ResourceType.DATA_STORAGE: '2017-11-09',
ResourceType.DATA_STORAGE_BLOB: '2017-11-09',
ResourceType.DATA_STORAGE_FILEDATALAKE: '2017-11-09',
ResourceType.DATA_STORAGE_FILESHARE: '2017-11-09',
ResourceType.DATA_STORAGE_QUEUE: '2017-11-09',
ResourceType.DATA_COSMOS_TABLE: '2017-04-17',
# Full MultiAPI support is not done in AppService, the line below is merely
# to have commands show up in the hybrid profile which happens to have the latest
# API versions
ResourceType.MGMT_APPSERVICE: '2018-02-01',
ResourceType.MGMT_EVENTHUB: '2022-01-01-preview',
ResourceType.MGMT_SERVICEBUS: '2022-10-01-preview',
ResourceType.MGMT_IOTHUB: '2019-03-22',
ResourceType.MGMT_DATABOXEDGE: '2019-08-01'
},
'2018-03-01-hybrid': {
ResourceType.MGMT_STORAGE: '2016-01-01',
ResourceType.MGMT_NETWORK: '2017-10-01',
ResourceType.MGMT_COMPUTE: SDKProfile('2017-03-30'),
ResourceType.MGMT_MSI: '2018-11-30',
ResourceType.MGMT_RESOURCE_LINKS: '2016-09-01',
ResourceType.MGMT_RESOURCE_LOCKS: '2016-09-01',
ResourceType.MGMT_RESOURCE_POLICY: '2016-12-01',
ResourceType.MGMT_RESOURCE_RESOURCES: '2018-02-01',
ResourceType.MGMT_RESOURCE_SUBSCRIPTIONS: '2016-06-01',
ResourceType.MGMT_RESOURCE_TEMPLATESPECS: '2015-01-01',
ResourceType.MGMT_RESOURCE_PRIVATELINKS: '2020-05-01',
ResourceType.MGMT_RESOURCE_MANAGEDAPPLICATIONS: '2019-07-01',
ResourceType.MGMT_NETWORK_DNS: '2016-04-01',
ResourceType.MGMT_KEYVAULT: '2016-10-01',
ResourceType.MGMT_AUTHORIZATION: SDKProfile('2015-07-01'),
# The order does make things different.
# Please keep ResourceType.DATA_KEYVAULT_KEYS before ResourceType.DATA_KEYVAULT
ResourceType.DATA_KEYVAULT_CERTIFICATES: None,
ResourceType.DATA_KEYVAULT_KEYS: None,
ResourceType.DATA_KEYVAULT_SECRETS: None,
ResourceType.DATA_STORAGE: '2017-04-17',
ResourceType.DATA_STORAGE_BLOB: '2017-04-17',
ResourceType.DATA_STORAGE_FILEDATALAKE: '2017-04-17',
ResourceType.DATA_STORAGE_FILESHARE: '2017-04-17',
ResourceType.DATA_STORAGE_QUEUE: '2017-04-17',
ResourceType.DATA_COSMOS_TABLE: '2017-04-17'
},
'2017-03-09-profile': {
ResourceType.MGMT_STORAGE: '2016-01-01',
ResourceType.MGMT_NETWORK: '2015-06-15',
ResourceType.MGMT_COMPUTE: SDKProfile('2016-03-30'),
ResourceType.MGMT_MSI: '2018-11-30',
ResourceType.MGMT_RESOURCE_LINKS: '2016-09-01',
ResourceType.MGMT_RESOURCE_LOCKS: '2015-01-01',
ResourceType.MGMT_RESOURCE_POLICY: '2015-10-01-preview',
ResourceType.MGMT_RESOURCE_RESOURCES: '2016-02-01',
ResourceType.MGMT_RESOURCE_SUBSCRIPTIONS: '2016-06-01',
ResourceType.MGMT_RESOURCE_PRIVATELINKS: '2020-05-01',
ResourceType.MGMT_RESOURCE_TEMPLATESPECS: '2015-01-01',
ResourceType.MGMT_RESOURCE_MANAGEDAPPLICATIONS: '2019-07-01',
ResourceType.MGMT_NETWORK_DNS: '2016-04-01',
ResourceType.MGMT_KEYVAULT: '2016-10-01',
ResourceType.MGMT_AUTHORIZATION: SDKProfile('2015-07-01'),
# The order does make things different.
# Please keep ResourceType.DATA_KEYVAULT_KEYS before ResourceType.DATA_KEYVAULT
ResourceType.DATA_KEYVAULT_CERTIFICATES: None,
ResourceType.DATA_KEYVAULT_KEYS: None,
ResourceType.DATA_KEYVAULT_SECRETS: None,
ResourceType.DATA_STORAGE: '2015-04-05',
ResourceType.DATA_STORAGE_BLOB: '2015-04-05',
ResourceType.DATA_STORAGE_FILEDATALAKE: '2015-04-05',
ResourceType.DATA_STORAGE_FILESHARE: '2015-04-05',
ResourceType.DATA_STORAGE_QUEUE: '2015-04-05'
}
}


# We should avoid using ad hoc API versions,
# use the version in a profile as much as possible.
AD_HOC_API_VERSIONS = {
ResourceType.MGMT_IOTHUB: {
# src/azure-cli/azure/cli/command_modules/iot/custom.py#iot_hub_devicestream_show
'iot_hub_resource': '2019-07-01-preview',
},
ResourceType.MGMT_APPSERVICE: {
# src/azure-cli/azure/cli/command_modules/appservice/_constants.py:68
'app_service_certificate_orders': '2022-09-01'
Expand Down
26 changes: 3 additions & 23 deletions src/azure-cli-core/azure/cli/core/tests/test_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,27 +88,7 @@ def test_add_get_cloud_with_profile(self):
cli = DummyCli()
endpoint_rm = 'http://management.contoso.com'
endpoints = CloudEndpoints(resource_manager=endpoint_rm)
profile = '2017-03-09-profile'
c = Cloud('MyOwnCloud', endpoints=endpoints, profile=profile)
with mock.patch('azure.cli.core.cloud.CLOUD_CONFIG_FILE', tempfile.mkstemp()[1]) as\
config_file:
add_cloud(cli, c)
config = configparser.ConfigParser()
config.read(config_file)
self.assertTrue(c.name in config.sections())
self.assertEqual(config.get(c.name, 'endpoint_resource_manager'), endpoint_rm)
self.assertEqual(config.get(c.name, 'profile'), profile)
custom_clouds = get_custom_clouds(cli)
self.assertEqual(len(custom_clouds), 1)
self.assertEqual(custom_clouds[0].name, c.name)
self.assertEqual(custom_clouds[0].endpoints.resource_manager, c.endpoints.resource_manager)
self.assertEqual(custom_clouds[0].profile, c.profile)

def test_add_get_cloud_with_hybrid_profile(self):
cli = DummyCli()
endpoint_rm = 'http://management.contoso.com'
endpoints = CloudEndpoints(resource_manager=endpoint_rm)
profile = '2018-03-01-hybrid'
profile = 'latest'
c = Cloud('MyOwnCloud', endpoints=endpoints, profile=profile)
with mock.patch('azure.cli.core.cloud.CLOUD_CONFIG_FILE', tempfile.mkstemp()[1]) as\
config_file:
Expand Down Expand Up @@ -152,7 +132,7 @@ def test_custom_cloud_management_endpoint_set(self):
endpoint_rm = 'http://management.contoso.com'
endpoint_mgmt = 'http://management.core.contoso.com'
endpoints = CloudEndpoints(resource_manager=endpoint_rm, management=endpoint_mgmt)
profile = '2017-03-09-profile'
profile = 'latest'
c = Cloud('MyOwnCloud', endpoints=endpoints, profile=profile)
with mock.patch('azure.cli.core.cloud.CLOUD_CONFIG_FILE', tempfile.mkstemp()[1]):
add_cloud(cli, c)
Expand All @@ -169,7 +149,7 @@ def test_custom_cloud_no_management_endpoint_set(self):
cli = DummyCli()
endpoint_rm = 'http://management.contoso.com'
endpoints = CloudEndpoints(resource_manager=endpoint_rm)
profile = '2017-03-09-profile'
profile = 'latest'
c = Cloud('MyOwnCloud', endpoints=endpoints, profile=profile)
with mock.patch('azure.cli.core.cloud.CLOUD_CONFIG_FILE', tempfile.mkstemp()[1]):
add_cloud(cli, c)
Expand Down
Loading
Loading