Skip to content

Commit a66bcbd

Browse files
authored
[Core] BREAKING CHANGE: Remove azure stack profiles 2020-09-01-hybrid, 2019-03-01-hybrid, 2018-03-01-hybrid and 2017-03-09-profile (#31307)
* remove profiles in core * remove full test pipeline * remove tests for profiles * clean up code in storage * clean up code in vm and network * remove profiles in core * fix style issues * fix tests * fix style issue * Update src/azure-cli-core/azure/cli/core/profiles/_shared.py * add back storage azure stack * add warning messages * add warning messages * fix style issue * Update src/azure-cli/azure/cli/command_modules/cloud/__init__.py * Update src/azure-cli-core/azure/cli/core/cloud.py * Update src/azure-cli-core/azure/cli/core/cloud.py * Update src/azure-cli/azure/cli/command_modules/cloud/__init__.py
1 parent e435819 commit a66bcbd

File tree

10 files changed

+37
-290
lines changed

10 files changed

+37
-290
lines changed

azure-pipelines-full-tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ variables:
1616
- template: ${{ variables.Pipeline.Workspace }}/.azure-pipelines/templates/variables.yml
1717

1818
jobs:
19-
2019
- job: AutomationFullTestPython39ProfileLatest
2120
displayName: Automation Full Test Python39 Profile Latest
2221
timeoutInMinutes: 9999

src/azure-cli-core/azure/cli/core/_breaking_change.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,3 @@
33
# Licensed under the MIT License. See License.txt in the project root for license information.
44
# --------------------------------------------------------------------------------------------
55
# pylint: disable=line-too-long
6-
7-
from azure.cli.core.breaking_change import AzCLIOtherChange, register_conditional_breaking_change
8-
9-
register_conditional_breaking_change(
10-
tag='CloudProfilesDeprecate',
11-
breaking_change=AzCLIOtherChange(
12-
cmd='',
13-
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-
)
15-
)

src/azure-cli-core/azure/cli/core/cloud.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,19 @@ def get_clouds(cli_ctx):
596596
# If profile isn't set, use latest
597597
setattr(c, 'profile', 'latest')
598598
if c.profile not in API_PROFILES:
599-
raise CLIError('Profile {} does not exist or is not supported.'.format(c.profile))
599+
if c.profile in (
600+
"2017-03-09-profile",
601+
"2018-03-01-hybrid",
602+
"2019-03-01-hybrid",
603+
"2020-09-01-hybrid",
604+
):
605+
logger.error(
606+
"The azure stack profile '%s' has been deprecated and removed, using the 'latest' profile instead.\n"
607+
"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
608+
)
609+
c.profile = 'latest'
610+
else:
611+
raise CLIError('Profile {} does not exist or is not supported.'.format(c.profile))
600612
if not c.endpoints.has_endpoint_set('management') and \
601613
c.endpoints.has_endpoint_set('resource_manager'):
602614
# If management endpoint not set, use resource manager endpoint

src/azure-cli-core/azure/cli/core/profiles/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,6 @@ def get_sdk(cli_ctx, resource_type, *attr_args, **kwargs):
9494
# API Profiles currently supported in the CLI.
9595
API_PROFILES = {
9696
'latest': AZURE_API_PROFILES['latest'],
97-
'2017-03-09-profile': AZURE_API_PROFILES['2017-03-09-profile'],
98-
'2018-03-01-hybrid': AZURE_API_PROFILES['2018-03-01-hybrid'],
99-
'2019-03-01-hybrid': AZURE_API_PROFILES['2019-03-01-hybrid'],
100-
'2020-09-01-hybrid': AZURE_API_PROFILES['2020-09-01-hybrid']
10197
}
10298

10399

src/azure-cli-core/azure/cli/core/profiles/_shared.py

Lines changed: 4 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -263,163 +263,17 @@ def default_api_version(self):
263263
ResourceType.MGMT_CUSTOMLOCATION: '2021-03-15-preview',
264264
ResourceType.MGMT_CONTAINERSERVICE: SDKProfile('2025-02-01'),
265265
ResourceType.MGMT_APPCONTAINERS: '2022-10-01',
266-
},
267-
'2020-09-01-hybrid': {
268-
ResourceType.MGMT_STORAGE: '2019-06-01',
269-
ResourceType.MGMT_NETWORK: '2018-11-01',
270-
ResourceType.MGMT_COMPUTE: SDKProfile('2020-06-01', {
271-
'resource_skus': '2019-04-01',
272-
'disks': '2019-07-01',
273-
'disk_encryption_sets': '2019-07-01',
274-
'disk_accesses': '2020-05-01',
275-
'snapshots': '2019-07-01',
276-
'galleries': '2019-12-01',
277-
'gallery_images': '2019-12-01',
278-
'gallery_image_versions': '2019-12-01',
279-
'virtual_machine_scale_sets': '2020-06-01'
280-
}),
281-
ResourceType.MGMT_KEYVAULT: '2016-10-01',
282-
ResourceType.MGMT_MSI: '2018-11-30',
283-
ResourceType.MGMT_RESOURCE_FEATURES: '2021-07-01',
284-
ResourceType.MGMT_RESOURCE_LINKS: '2016-09-01',
285-
ResourceType.MGMT_RESOURCE_LOCKS: '2016-09-01',
286-
ResourceType.MGMT_RESOURCE_POLICY: '2016-12-01',
287-
ResourceType.MGMT_RESOURCE_RESOURCES: '2019-10-01',
288-
ResourceType.MGMT_RESOURCE_SUBSCRIPTIONS: '2016-06-01',
289-
ResourceType.MGMT_RESOURCE_TEMPLATESPECS: '2015-01-01',
290-
ResourceType.MGMT_RESOURCE_PRIVATELINKS: '2020-05-01',
291-
ResourceType.MGMT_RESOURCE_MANAGEDAPPLICATIONS: '2019-07-01',
292-
ResourceType.MGMT_NETWORK_DNS: '2016-04-01',
293-
ResourceType.MGMT_AUTHORIZATION: SDKProfile('2015-07-01', {
294-
'policy_assignments': '2016-12-01',
295-
'policy_definitions': '2016-12-01'
296-
}),
297-
# The order does make things different.
298-
# Please keep ResourceType.DATA_KEYVAULT_KEYS before ResourceType.DATA_KEYVAULT
299-
ResourceType.DATA_KEYVAULT_CERTIFICATES: None,
300-
ResourceType.DATA_KEYVAULT_KEYS: None,
301-
ResourceType.DATA_KEYVAULT_SECRETS: None,
302-
ResourceType.DATA_STORAGE: '2018-11-09',
303-
ResourceType.DATA_STORAGE_BLOB: '2019-07-07',
304-
ResourceType.DATA_STORAGE_FILEDATALAKE: '2019-07-07',
305-
ResourceType.DATA_STORAGE_FILESHARE: '2019-07-07',
306-
ResourceType.DATA_STORAGE_QUEUE: '2019-07-07',
307-
ResourceType.DATA_COSMOS_TABLE: '2017-04-17',
308-
ResourceType.MGMT_APPSERVICE: '2018-02-01',
309-
ResourceType.MGMT_EVENTHUB: '2022-01-01-preview',
310-
ResourceType.MGMT_SERVICEBUS: '2022-10-01-preview',
311-
ResourceType.MGMT_IOTHUB: '2019-07-01-preview',
312-
ResourceType.MGMT_DATABOXEDGE: '2019-08-01',
313-
ResourceType.MGMT_CONTAINERREGISTRY: '2019-05-01',
314-
ResourceType.MGMT_CONTAINERSERVICE: SDKProfile('2020-11-01', {
315-
'container_services': '2017-07-01',
316-
'open_shift_managed_clusters': '2019-09-30-preview'
317-
})
318-
},
319-
'2019-03-01-hybrid': {
320-
ResourceType.MGMT_STORAGE: '2017-10-01',
321-
ResourceType.MGMT_NETWORK: '2017-10-01',
322-
ResourceType.MGMT_COMPUTE: SDKProfile('2017-12-01', {
323-
'resource_skus': '2017-09-01',
324-
'disks': '2017-03-30',
325-
'snapshots': '2017-03-30'
326-
}),
327-
ResourceType.MGMT_MSI: '2018-11-30',
328-
ResourceType.MGMT_RESOURCE_LINKS: '2016-09-01',
329-
ResourceType.MGMT_RESOURCE_LOCKS: '2016-09-01',
330-
ResourceType.MGMT_RESOURCE_POLICY: '2016-12-01',
331-
ResourceType.MGMT_RESOURCE_RESOURCES: '2018-05-01',
332-
ResourceType.MGMT_RESOURCE_SUBSCRIPTIONS: '2016-06-01',
333-
ResourceType.MGMT_RESOURCE_TEMPLATESPECS: '2015-01-01',
334-
ResourceType.MGMT_RESOURCE_PRIVATELINKS: '2020-05-01',
335-
ResourceType.MGMT_RESOURCE_MANAGEDAPPLICATIONS: '2019-07-01',
336-
ResourceType.MGMT_NETWORK_DNS: '2016-04-01',
337-
ResourceType.MGMT_KEYVAULT: '2016-10-01',
338-
ResourceType.MGMT_AUTHORIZATION: SDKProfile('2015-07-01', {
339-
'policy_assignments': '2016-12-01',
340-
'policy_definitions': '2016-12-01'
341-
}),
342-
# The order does make things different.
343-
# Please keep ResourceType.DATA_KEYVAULT_KEYS before ResourceType.DATA_KEYVAULT
344-
ResourceType.DATA_KEYVAULT_CERTIFICATES: None,
345-
ResourceType.DATA_KEYVAULT_KEYS: None,
346-
ResourceType.DATA_KEYVAULT_SECRETS: None,
347-
ResourceType.DATA_STORAGE: '2017-11-09',
348-
ResourceType.DATA_STORAGE_BLOB: '2017-11-09',
349-
ResourceType.DATA_STORAGE_FILEDATALAKE: '2017-11-09',
350-
ResourceType.DATA_STORAGE_FILESHARE: '2017-11-09',
351-
ResourceType.DATA_STORAGE_QUEUE: '2017-11-09',
352-
ResourceType.DATA_COSMOS_TABLE: '2017-04-17',
353-
# Full MultiAPI support is not done in AppService, the line below is merely
354-
# to have commands show up in the hybrid profile which happens to have the latest
355-
# API versions
356-
ResourceType.MGMT_APPSERVICE: '2018-02-01',
357-
ResourceType.MGMT_EVENTHUB: '2022-01-01-preview',
358-
ResourceType.MGMT_SERVICEBUS: '2022-10-01-preview',
359-
ResourceType.MGMT_IOTHUB: '2019-03-22',
360-
ResourceType.MGMT_DATABOXEDGE: '2019-08-01'
361-
},
362-
'2018-03-01-hybrid': {
363-
ResourceType.MGMT_STORAGE: '2016-01-01',
364-
ResourceType.MGMT_NETWORK: '2017-10-01',
365-
ResourceType.MGMT_COMPUTE: SDKProfile('2017-03-30'),
366-
ResourceType.MGMT_MSI: '2018-11-30',
367-
ResourceType.MGMT_RESOURCE_LINKS: '2016-09-01',
368-
ResourceType.MGMT_RESOURCE_LOCKS: '2016-09-01',
369-
ResourceType.MGMT_RESOURCE_POLICY: '2016-12-01',
370-
ResourceType.MGMT_RESOURCE_RESOURCES: '2018-02-01',
371-
ResourceType.MGMT_RESOURCE_SUBSCRIPTIONS: '2016-06-01',
372-
ResourceType.MGMT_RESOURCE_TEMPLATESPECS: '2015-01-01',
373-
ResourceType.MGMT_RESOURCE_PRIVATELINKS: '2020-05-01',
374-
ResourceType.MGMT_RESOURCE_MANAGEDAPPLICATIONS: '2019-07-01',
375-
ResourceType.MGMT_NETWORK_DNS: '2016-04-01',
376-
ResourceType.MGMT_KEYVAULT: '2016-10-01',
377-
ResourceType.MGMT_AUTHORIZATION: SDKProfile('2015-07-01'),
378-
# The order does make things different.
379-
# Please keep ResourceType.DATA_KEYVAULT_KEYS before ResourceType.DATA_KEYVAULT
380-
ResourceType.DATA_KEYVAULT_CERTIFICATES: None,
381-
ResourceType.DATA_KEYVAULT_KEYS: None,
382-
ResourceType.DATA_KEYVAULT_SECRETS: None,
383-
ResourceType.DATA_STORAGE: '2017-04-17',
384-
ResourceType.DATA_STORAGE_BLOB: '2017-04-17',
385-
ResourceType.DATA_STORAGE_FILEDATALAKE: '2017-04-17',
386-
ResourceType.DATA_STORAGE_FILESHARE: '2017-04-17',
387-
ResourceType.DATA_STORAGE_QUEUE: '2017-04-17',
388-
ResourceType.DATA_COSMOS_TABLE: '2017-04-17'
389-
},
390-
'2017-03-09-profile': {
391-
ResourceType.MGMT_STORAGE: '2016-01-01',
392-
ResourceType.MGMT_NETWORK: '2015-06-15',
393-
ResourceType.MGMT_COMPUTE: SDKProfile('2016-03-30'),
394-
ResourceType.MGMT_MSI: '2018-11-30',
395-
ResourceType.MGMT_RESOURCE_LINKS: '2016-09-01',
396-
ResourceType.MGMT_RESOURCE_LOCKS: '2015-01-01',
397-
ResourceType.MGMT_RESOURCE_POLICY: '2015-10-01-preview',
398-
ResourceType.MGMT_RESOURCE_RESOURCES: '2016-02-01',
399-
ResourceType.MGMT_RESOURCE_SUBSCRIPTIONS: '2016-06-01',
400-
ResourceType.MGMT_RESOURCE_PRIVATELINKS: '2020-05-01',
401-
ResourceType.MGMT_RESOURCE_TEMPLATESPECS: '2015-01-01',
402-
ResourceType.MGMT_RESOURCE_MANAGEDAPPLICATIONS: '2019-07-01',
403-
ResourceType.MGMT_NETWORK_DNS: '2016-04-01',
404-
ResourceType.MGMT_KEYVAULT: '2016-10-01',
405-
ResourceType.MGMT_AUTHORIZATION: SDKProfile('2015-07-01'),
406-
# The order does make things different.
407-
# Please keep ResourceType.DATA_KEYVAULT_KEYS before ResourceType.DATA_KEYVAULT
408-
ResourceType.DATA_KEYVAULT_CERTIFICATES: None,
409-
ResourceType.DATA_KEYVAULT_KEYS: None,
410-
ResourceType.DATA_KEYVAULT_SECRETS: None,
411-
ResourceType.DATA_STORAGE: '2015-04-05',
412-
ResourceType.DATA_STORAGE_BLOB: '2015-04-05',
413-
ResourceType.DATA_STORAGE_FILEDATALAKE: '2015-04-05',
414-
ResourceType.DATA_STORAGE_FILESHARE: '2015-04-05',
415-
ResourceType.DATA_STORAGE_QUEUE: '2015-04-05'
416266
}
417267
}
418268

419269

420270
# We should avoid using ad hoc API versions,
421271
# use the version in a profile as much as possible.
422272
AD_HOC_API_VERSIONS = {
273+
ResourceType.MGMT_IOTHUB: {
274+
# src/azure-cli/azure/cli/command_modules/iot/custom.py#iot_hub_devicestream_show
275+
'iot_hub_resource': '2019-07-01-preview',
276+
},
423277
ResourceType.MGMT_APPSERVICE: {
424278
# src/azure-cli/azure/cli/command_modules/appservice/_constants.py:68
425279
'app_service_certificate_orders': '2022-09-01'

src/azure-cli-core/azure/cli/core/tests/test_cloud.py

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -88,27 +88,7 @@ def test_add_get_cloud_with_profile(self):
8888
cli = DummyCli()
8989
endpoint_rm = 'http://management.contoso.com'
9090
endpoints = CloudEndpoints(resource_manager=endpoint_rm)
91-
profile = '2017-03-09-profile'
92-
c = Cloud('MyOwnCloud', endpoints=endpoints, profile=profile)
93-
with mock.patch('azure.cli.core.cloud.CLOUD_CONFIG_FILE', tempfile.mkstemp()[1]) as\
94-
config_file:
95-
add_cloud(cli, c)
96-
config = configparser.ConfigParser()
97-
config.read(config_file)
98-
self.assertTrue(c.name in config.sections())
99-
self.assertEqual(config.get(c.name, 'endpoint_resource_manager'), endpoint_rm)
100-
self.assertEqual(config.get(c.name, 'profile'), profile)
101-
custom_clouds = get_custom_clouds(cli)
102-
self.assertEqual(len(custom_clouds), 1)
103-
self.assertEqual(custom_clouds[0].name, c.name)
104-
self.assertEqual(custom_clouds[0].endpoints.resource_manager, c.endpoints.resource_manager)
105-
self.assertEqual(custom_clouds[0].profile, c.profile)
106-
107-
def test_add_get_cloud_with_hybrid_profile(self):
108-
cli = DummyCli()
109-
endpoint_rm = 'http://management.contoso.com'
110-
endpoints = CloudEndpoints(resource_manager=endpoint_rm)
111-
profile = '2018-03-01-hybrid'
91+
profile = 'latest'
11292
c = Cloud('MyOwnCloud', endpoints=endpoints, profile=profile)
11393
with mock.patch('azure.cli.core.cloud.CLOUD_CONFIG_FILE', tempfile.mkstemp()[1]) as\
11494
config_file:
@@ -152,7 +132,7 @@ def test_custom_cloud_management_endpoint_set(self):
152132
endpoint_rm = 'http://management.contoso.com'
153133
endpoint_mgmt = 'http://management.core.contoso.com'
154134
endpoints = CloudEndpoints(resource_manager=endpoint_rm, management=endpoint_mgmt)
155-
profile = '2017-03-09-profile'
135+
profile = 'latest'
156136
c = Cloud('MyOwnCloud', endpoints=endpoints, profile=profile)
157137
with mock.patch('azure.cli.core.cloud.CLOUD_CONFIG_FILE', tempfile.mkstemp()[1]):
158138
add_cloud(cli, c)
@@ -169,7 +149,7 @@ def test_custom_cloud_no_management_endpoint_set(self):
169149
cli = DummyCli()
170150
endpoint_rm = 'http://management.contoso.com'
171151
endpoints = CloudEndpoints(resource_manager=endpoint_rm)
172-
profile = '2017-03-09-profile'
152+
profile = 'latest'
173153
c = Cloud('MyOwnCloud', endpoints=endpoints, profile=profile)
174154
with mock.patch('azure.cli.core.cloud.CLOUD_CONFIG_FILE', tempfile.mkstemp()[1]):
175155
add_cloud(cli, c)

0 commit comments

Comments
 (0)