Skip to content

Commit 56c8124

Browse files
authored
{Core} Add breaking change warning for azure stack users (#31160)
* {core} add breaking change warning for azure stack users * add breaking change messages
1 parent 68ef754 commit 56c8124

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# --------------------------------------------------------------------------------------------
5+
# 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: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,13 +622,16 @@ def get_active_cloud(cli_ctx=None):
622622
from azure.cli.core import get_default_cli
623623
cli_ctx = get_default_cli()
624624
try:
625-
return get_cloud(cli_ctx, get_active_cloud_name(cli_ctx))
625+
cloud = get_cloud(cli_ctx, get_active_cloud_name(cli_ctx))
626626
except CloudNotRegisteredException as err:
627627
logger.warning(err)
628628
default_cloud_name = get_default_cloud_name()
629629
logger.warning("Resetting active cloud to'%s'.", default_cloud_name)
630630
_set_active_cloud(cli_ctx, default_cloud_name)
631-
return get_cloud(cli_ctx, default_cloud_name)
631+
cloud = get_cloud(cli_ctx, default_cloud_name)
632+
if cloud.profile != 'latest':
633+
logger.warning("Cloud profile '%s' will be deprecated starting from 2.73.0. Please use the 'latest' profile or the CLI 2.66.* (LTS) version instead.", cloud.profile)
634+
return cloud
632635

633636

634637
def get_cloud_subscription(cloud_name):

0 commit comments

Comments
 (0)