vnet related azcli commands:¶

Creating new vnet with all defaults:¶

$ az network vnet create --name vnet_first -g rg0x001 --subnet-name myfirst
[[ lots of json snipped ]]

Displaying information from configured vnets:¶

$ az network vnet list
[[ lots of json snipped ]]

Display vnet name and location:¶

$ az network vnet list --query '[].[name,location]' --output table
Column1       Column2
------------  ---------
rg0x001-vnet  centralus
vnet_first    centralus

Display vnet name, location,a nd cidr:¶

$ az network vnet list --query '[].[name,location,subnets[0].addressPrefix]' --output table
Column1       Column2    Column3
------------  ---------  -----------
rg0x001-vnet  centralus  10.0.0.0/24
vnet_first    centralus  10.0.0.0/24

Adding a second subnet to a vnet:¶

az network vnet subnet create -n mysecond --vnet-name vnet_first \
  -g rg0x001 --address-prefixes "10.0.1.0/24"
[[json snipped]]

Listing subnets in a vnet:¶

$ az network vnet list --query '[].[name,
subnets[].addressPrefix, subnets[].name]' --output table
Column1       Column2                         Column3
------------  ------------------------------  -----------------------
rg0x001-vnet  ['10.0.0.0/24']                 ['default']
vnet_first    ['10.0.1.0/24', '10.0.0.0/24']  ['mysecond', 'myfirst']

az network vnet subnet list -g rg0x001 --vnet-name vnet_first --query '
[].{Name:name, CIDR:addressPrefix}' --output table
Name      CIDR
--------  -----------
mysecond  10.0.1.0/24
myfirst   10.0.0.0/24

Add an nsg to a subnet:¶

$ az network vnet subnet update -g rg0x001 \
  -n mysecond --vnet-name vnet_first \
  --network-security-group nsg0x001
[[json snipped]]

OCI

Navigation

  • Cloud related lessons learned
    • AWS:
    • Azure:
  • (Reasonably) current lessons learned:
  • Legacy/archived lessons learned:

Related Topics

  • Documentation overview
    • Cloud related lessons learned
      • Azure lessons learned:
        • Previous: azcli info related to vms:
        • Next: (Reasonably) current lessons learned:

Quick search

©2023, dkoleary. | Powered by Sphinx 7.2.6 & Alabaster 0.7.16 | Page source