Skip to content

Commit

Permalink
[Network] BREAKING CHANGE: az network vnet subnet create: Disable `…
Browse files Browse the repository at this point in the history
…PrivateEndpointNetworkPolicies` by default (#22962)

* disable PrivateEndpointNetworkPolicies by default

* disable PrivateEndpointNetworkPolicies when creating with vnet

* refine help message
  • Loading branch information
necusjz committed Jun 28, 2022
1 parent 11eacf0 commit f4e455c
Show file tree
Hide file tree
Showing 5 changed files with 391 additions and 399 deletions.
2 changes: 1 addition & 1 deletion src/azure-cli/azure/cli/command_modules/network/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -2009,7 +2009,7 @@ def load_arguments(self, _):
c.argument('service_endpoints', nargs='+', min_api='2017-06-01')
c.argument('service_endpoint_policy', nargs='+', min_api='2018-07-01', help='Space-separated list of names or IDs of service endpoint policies to apply.', validator=validate_service_endpoint_policy)
c.argument('delegations', nargs='+', min_api='2017-08-01', help='Space-separated list of services to whom the subnet should be delegated. (e.g. Microsoft.Sql/servers)', validator=validate_delegations)
c.argument('disable_private_endpoint_network_policies', arg_type=get_three_state_flag(), min_api='2019-04-01', help='Disable private endpoint network policies on the subnet.')
c.argument('disable_private_endpoint_network_policies', arg_type=get_three_state_flag(), min_api='2019-04-01', help='Disable private endpoint network policies on the subnet, Disabled by default.')
c.argument('disable_private_link_service_network_policies', arg_type=get_three_state_flag(), min_api='2019-04-01', help='Disable private link service network policies on the subnet.')

with self.argument_context('network vnet subnet create') as c:
Expand Down
3 changes: 2 additions & 1 deletion src/azure-cli/azure/cli/command_modules/network/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -6998,6 +6998,7 @@ def create_vnet(cmd, resource_group_name, vnet_name, vnet_prefixes='10.0.0.0/16'
vnet.subnets = [Subnet(name=subnet_name,
address_prefix=subnet_prefix[0] if len(subnet_prefix) == 1 else None,
address_prefixes=subnet_prefix if len(subnet_prefix) > 1 else None,
private_endpoint_network_policies='Disabled',
network_security_group=NetworkSecurityGroup(id=network_security_group)
if network_security_group else None)]
else:
Expand Down Expand Up @@ -7119,7 +7120,7 @@ def create_subnet(cmd, resource_group_name, virtual_network_name, subnet_name,
if delegations:
subnet.delegations = delegations

if disable_private_endpoint_network_policies is True:
if disable_private_endpoint_network_policies is None or disable_private_endpoint_network_policies is True:
subnet.private_endpoint_network_policies = "Disabled"
if disable_private_endpoint_network_policies is False:
subnet.private_endpoint_network_policies = "Enabled"
Expand Down

Large diffs are not rendered by default.

Loading

0 comments on commit f4e455c

Please sign in to comment.