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

Preview

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

--name -n

The subnet name.

--resource-group -g

The resource group name.

--vnet-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

Address prefixes for the subnet in CIDR format.

--default-outbound-access --default-outbound

Whether default outbound access is enabled.

--delegations --delegated-services

Services to which to delegate the subnet, e.g. Microsoft.Web/serverFarms.

--disable-private-endpoint-network-policies

Disable network policies for private endpoints.

--disable-private-link-service-network-policies

Disable network policies for private link services.

--ipam-allocations --ipam-pool-prefix-allocations

Resource ids of IPAM pools from which to allocate subnet prefixes.

--nat-gateway

Name or resource id of the NAT gateway to associate.

--network-security-group --nsg

Name or resource id of the network security group to associate.

--private-endpoint-network-policies --ple-network-policies

Network policies for private endpoints.

Property Value
Accepted values: Disabled, Enabled, NetworkSecurityGroupEnabled, RouteTableEnabled
--private-link-service-network-policies --pls-network-policies

Network policies for private link services.

Property Value
Accepted values: Disabled, Enabled
--profile

Use the named profile for this command (overrides the active profile).

--route-table

Name or resource id of the route table to associate.

--service-endpoint-policy --service-endpoint-policies --policies

Names or resource ids of service endpoint policies to associate.

--service-endpoints --endpoints

Services for which to enable service endpoints.

--sharing-scope

Tenant sharing scope for the subnet.

Property Value
Accepted values: DelegatedServices, Tenant
--subscription-id

Azure Subscription Id. Defaults to the active profile's subscription.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h -help -? --?

Show help for the command or group and exit.

--no-cache

Bypass the extension discovery cache and reload extensions from disk.

--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, table, tsv, yaml, yamlc
--query

JMESPath query string to filter/project the command result before rendering.

az network vnet subnet delete

Preview

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

--name -n

The subnet name.

--resource-group -g

The resource group name.

--vnet-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.

--profile

Use the named profile for this command (overrides the active profile).

--subscription-id

Azure Subscription Id. Defaults to the active profile's subscription.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h -help -? --?

Show help for the command or group and exit.

--no-cache

Bypass the extension discovery cache and reload extensions from disk.

--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, table, tsv, yaml, yamlc
--query

JMESPath query string to filter/project the command result before rendering.

az network vnet subnet list

Preview

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

--resource-group -g

The resource group name.

--vnet-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.

--profile

Use the named profile for this command (overrides the active profile).

--subscription-id

Azure Subscription Id. Defaults to the active profile's subscription.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h -help -? --?

Show help for the command or group and exit.

--no-cache

Bypass the extension discovery cache and reload extensions from disk.

--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, table, tsv, yaml, yamlc
--query

JMESPath query string to filter/project the command result before rendering.

az network vnet subnet show

Preview

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

--name -n

The subnet name.

--resource-group -g

The resource group name.

--vnet-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

Expand referenced resources, e.g. subnets/ipConfigurations.

--profile

Use the named profile for this command (overrides the active profile).

--subscription-id

Azure Subscription Id. Defaults to the active profile's subscription.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h -help -? --?

Show help for the command or group and exit.

--no-cache

Bypass the extension discovery cache and reload extensions from disk.

--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, table, tsv, yaml, yamlc
--query

JMESPath query string to filter/project the command result before rendering.