az network vnet subnet
Manage subnets in an Azure virtual network.
Commands
| Name | Description | Type | Status |
|---|---|---|---|
| az network vnet subnet create |
Create or update a subnet. |
Core | Preview |
| az network vnet subnet delete |
Delete a subnet. |
Core | Preview |
| az network vnet subnet list |
List subnets in a virtual network. |
Core | Preview |
| az network vnet subnet show |
Show a subnet. |
Core | Preview |
az network vnet subnet create
Create or update a subnet.
Create or replace a subnet in an existing virtual network.
az network vnet subnet create --name
--resource-group
--vnet-name
[--address-prefixes]
[--default-outbound-access --default-outbound]
[--delegations --delegated-services]
[--disable-private-endpoint-network-policies]
[--disable-private-link-service-network-policies]
[--ipam-allocations --ipam-pool-prefix-allocations]
[--nat-gateway]
[--network-security-group --nsg]
[--private-endpoint-network-policies --ple-network-policies {Disabled, Enabled, NetworkSecurityGroupEnabled, RouteTableEnabled}]
[--private-link-service-network-policies --pls-network-policies {Disabled, Enabled}]
[--profile]
[--route-table]
[--service-endpoint-policy --service-endpoint-policies --policies]
[--service-endpoints --endpoints]
[--sharing-scope {DelegatedServices, Tenant}]
[--subscription-id]
Examples
Create a subnet
az network vnet subnet create --resource-group myrg --vnet-name myvnet --name web --address-prefixes 10.0.1.0/24
Create a delegated subnet
az network vnet subnet create --resource-group myrg --vnet-name myvnet --name apps \
--address-prefixes 10.0.2.0/24 --delegations Microsoft.Web/serverFarms
Required Parameters
The subnet name.
The resource group name.
The virtual network name.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Address prefixes for the subnet in CIDR format.
Whether default outbound access is enabled.
Services to which to delegate the subnet, e.g. Microsoft.Web/serverFarms.
Disable network policies for private endpoints.
Disable network policies for private link services.
Resource ids of IPAM pools from which to allocate subnet prefixes.
Name or resource id of the NAT gateway to associate.
Name or resource id of the network security group to associate.
Network policies for private endpoints.
| Property | Value |
|---|---|
| Accepted values: | Disabled, Enabled, NetworkSecurityGroupEnabled, RouteTableEnabled |
Network policies for private link services.
| Property | Value |
|---|---|
| Accepted values: | Disabled, Enabled |
Use the named profile for this command (overrides the active profile).
Name or resource id of the route table to associate.
Names or resource ids of service endpoint policies to associate.
Services for which to enable service endpoints.
Tenant sharing scope for the subnet.
| Property | Value |
|---|---|
| Accepted values: | DelegatedServices, Tenant |
Azure Subscription Id. Defaults to the active profile's subscription.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.
az network vnet subnet delete
Delete a subnet.
Delete a subnet from a virtual network.
az network vnet subnet delete --name
--resource-group
--vnet-name
[--profile]
[--subscription-id]
Examples
Delete a subnet
az network vnet subnet delete --resource-group myrg --vnet-name myvnet --name web
Required Parameters
The subnet name.
The resource group name.
The virtual network name.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Use the named profile for this command (overrides the active profile).
Azure Subscription Id. Defaults to the active profile's subscription.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.
az network vnet subnet list
List subnets in a virtual network.
List every subnet in a virtual network.
az network vnet subnet list --resource-group
--vnet-name
[--profile]
[--subscription-id]
Examples
List subnets
az network vnet subnet list --resource-group myrg --vnet-name myvnet
Required Parameters
The resource group name.
The virtual network name.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Use the named profile for this command (overrides the active profile).
Azure Subscription Id. Defaults to the active profile's subscription.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.
az network vnet subnet show
Show a subnet.
Show a subnet in a virtual network.
az network vnet subnet show --name
--resource-group
--vnet-name
[--expand]
[--profile]
[--subscription-id]
Examples
Show a subnet
az network vnet subnet show --resource-group myrg --vnet-name myvnet --name web
Required Parameters
The subnet name.
The resource group name.
The virtual network name.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Expand referenced resources, e.g. subnets/ipConfigurations.
Use the named profile for this command (overrides the active profile).
Azure Subscription Id. Defaults to the active profile's subscription.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.