Skip to content

Commit

Permalink
[Network] az network lb create: Add warnings for default SKU (Azure…
Browse files Browse the repository at this point in the history
…#22339)

* add warnings for default sku
  • Loading branch information
necusjz authored May 11, 2022
1 parent 7415927 commit 5a4a23d
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/azure-cli/azure/cli/command_modules/network/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -3674,6 +3674,12 @@ def create_load_balancer(cmd, load_balancer_name, resource_group_name, location=
DeploymentProperties = cmd.get_models('DeploymentProperties', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES)
IPAllocationMethod = cmd.get_models('IPAllocationMethod')

if public_ip_address is None:
logger.warning(
"Please note that the default public IP used for creation will be changed from Basic to Standard "
"in the future."
)

tags = tags or {}
public_ip_address = public_ip_address or 'PublicIP{}'.format(load_balancer_name)
backend_pool_name = backend_pool_name or '{}bepool'.format(load_balancer_name)
Expand Down Expand Up @@ -3890,6 +3896,11 @@ def create_lb_frontend_ip_configuration(
ncf = network_client_factory(cmd.cli_ctx)
lb = lb_get(ncf.load_balancers, resource_group_name, load_balancer_name)

if public_ip_address is None:
logger.warning(
"Please note that the default public IP used for LB frontend will be changed from Basic to Standard "
"in the future."
)
if private_ip_address_allocation is None:
private_ip_address_allocation = 'static' if private_ip_address else 'dynamic'

Expand Down Expand Up @@ -6359,15 +6370,11 @@ def create_public_ip(cmd, resource_group_name, public_ip_address_name, location=
allocation_method=None, dns_name=None,
idle_timeout=4, reverse_fqdn=None, version=None, sku=None, tier=None, zone=None, ip_tags=None,
public_ip_prefix=None, edge_zone=None, ip_address=None):

# In the latest profile, the default public IP will be expected to be changed from Basic to Standard.
# In order to avoid breaking change which has a big impact to users,
# we use the hint to guide users to use Standard sku to create public IP.
if sku is None and cmd.cli_ctx.cloud.profile == 'latest':
if sku is None:
logger.warning(
'It is recommended to use parameter "--sku Standard" to create new public IP. '
'Please note that the default public IP used for creation will be changed from Basic to Standard '
'in the future.')
"Please note that the default public IP used for creation will be changed from Basic to Standard "
"in the future."
)

IPAllocationMethod, PublicIPAddress, PublicIPAddressDnsSettings, SubResource = cmd.get_models(
'IPAllocationMethod', 'PublicIPAddress', 'PublicIPAddressDnsSettings', 'SubResource')
Expand Down

0 comments on commit 5a4a23d

Please sign in to comment.