Share via


az stack-hci-vm network vnet subnet

Note

This reference is part of the stack-hci-vm extension for the Azure CLI (version 2.15.0 or higher). The extension will automatically install the first time you run an az stack-hci-vm network vnet subnet command. Learn more about extensions.

Manage subnets within a virtual network with stack-hci-vm.

Commands

Name Description Type Status
az stack-hci-vm network vnet subnet create

Create a subnet.

Extension GA
az stack-hci-vm network vnet subnet delete

Delete a subnet.

Extension GA
az stack-hci-vm network vnet subnet list

List all subnets in a virtual network.

Extension GA
az stack-hci-vm network vnet subnet show

Get the details of a subnet.

Extension GA
az stack-hci-vm network vnet subnet update

Update a subnet.

Extension GA

az stack-hci-vm network vnet subnet create

Create a subnet.

az stack-hci-vm network vnet subnet create --address-prefix
                                           --custom-location
                                           --name
                                           --resource-group
                                           --vnet-name
                                           [--location]
                                           [--nat-gateway]
                                           [--network-security-group]
                                           [--polling-interval]
                                           [--routes]
                                           [--tags]

Examples

CreateSubnet

az stack-hci-vm network vnet subnet create --resource-group "test-rg" --vnet-name "test-vnet" --name "test-subnet" --location "eastus" --tags env=prod subnettype=backend --custom-location "/subscriptions/xxxx/resourceGroups/test-rg/providers/Microsoft.ExtendedLocation/customLocations/test-location" --address-prefix "10.0.0.0/24" --network-security-group "/subscriptions/xxxx/resourceGroups/test-rg/providers/Microsoft.Network/networkSecurityGroups/test-nsg" --nat-gateway "/subscriptions/xxxx/resourceGroups/test-rg/providers/Microsoft.Network/natGateways/test-nat" --routes '[{"name":"default","address_prefix":"0.0.0.0/0","next_hop_ip_address":"10.0.0.1"}]' --polling-interval 30

Required Parameters

--address-prefix

Subnet CIDR (required).

--custom-location

The ID of the custom location.

--name -n

Name of the virtual network subnet.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--vnet-name

Name of the virtual network.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--location -l

If location is not specified, the location of the resource group is used.

--nat-gateway

Resource ID of the NAT Gateway to associate.

--network-security-group

Resource ID of the Network Security Group to associate.

--polling-interval

ARM polling interval for long running operations.

--routes

Collection of routes contained within a route table.

--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

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

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az stack-hci-vm network vnet subnet delete

Delete a subnet.

az stack-hci-vm network vnet subnet delete --name
                                           --resource-group
                                           --vnet-name
                                           [--polling-interval]
                                           [--yes]

Examples

DeleteSubnet

az stack-hci-vm network vnet subnet delete --vnet-name "test-vnet" --name "test-subnet" --resource-group "test-rg" --yes

Required Parameters

--name -n

Name of the virtual network subnet.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--vnet-name

Name of the virtual network.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--polling-interval

ARM polling interval for long running operations.

--yes -y

Do not prompt for confirmation.

Property Value
Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

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

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az stack-hci-vm network vnet subnet list

List all subnets in a virtual network.

az stack-hci-vm network vnet subnet list --vnet-name
                                         [--resource-group]

Examples

ListSubnets

az stack-hci-vm network vnet subnet list --resource-group "test-rg" --vnet-name "test-vnet"

Required Parameters

--vnet-name

Name of the virtual network.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

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

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az stack-hci-vm network vnet subnet show

Get the details of a subnet.

az stack-hci-vm network vnet subnet show --name
                                         --resource-group
                                         --vnet-name

Examples

ShowSubnet

az stack-hci-vm network vnet subnet show --vnet-name "test-vnet" --name "test-subnet" --resource-group "test-rg"

Required Parameters

--name -n

Name of the virtual network subnet.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--vnet-name

Name of the virtual network.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

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

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az stack-hci-vm network vnet subnet update

Update a subnet.

az stack-hci-vm network vnet subnet update --name
                                           --resource-group
                                           --vnet-name
                                           [--add]
                                           [--force-string]
                                           [--nat-gateway]
                                           [--network-security-group]
                                           [--remove]
                                           [--set]
                                           [--tags]

Examples

UpdateSubnet

az stack-hci-vm network vnet subnet update --resource-group "test-rg" --vnet-name "test-vnet" --name "test-subnet" --network-security-group "/subscriptions/xxxx/resourceGroups/test-rg/providers/Microsoft.Network/networkSecurityGroups/test-nsg" --nat-gateway "/subscriptions/xxxx/resourceGroups/test-rg/providers/Microsoft.Network/natGateways/test-nat" --tags env=prod updated=yes

Required Parameters

--name -n

Name of the virtual network subnet.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--vnet-name

Name of the virtual network.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.

Property Value
Parameter group: Generic Update Arguments
Default value: []
--force-string

When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.

Property Value
Parameter group: Generic Update Arguments
Default value: False
--nat-gateway

Resource ID of the NAT Gateway to associate.

--network-security-group

Resource ID of the Network Security Group to associate.

--remove

Remove a property or an element from a list. Example: --remove property.list <indexToRemove> OR --remove propertyToRemove.

Property Value
Parameter group: Generic Update Arguments
Default value: []
--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=<value>.

Property Value
Parameter group: Generic Update Arguments
Default value: []
--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

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

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False