LinuxCommandLibrary

az-network

Manage Azure network resources

TLDR

List network resources in a region that are used against a subscription quota

$ az network list-usages
copy

List all virtual networks in a subscription
$ az network vnet list
copy

Create a virtual network
$ az network vnet create --address-prefixes [10.0.0.0/16] [[-n|--name]] [vnet] [[-g|--resource-group]] [group_name] --submet-name [subnet] --subnet-prefixes [10.0.0.0/24]
copy

Enable accelerated networking for a network interface card
$ az network nic update --accelerated-networking true [[-n|--name]] [nic] [[-g|--resource-group]] [resource_group]
copy

SYNOPSIS

The `az network` command group is invoked as a subcommand of `az`. Its general synopsis is:

az network subcommand [parameters] [--options]

Where:

  • az: The main Azure CLI command.
  • network: The command group for networking services.
  • subcommand: A specific operation within the network group (e.g., `vnet`, `nsg`, `public-ip`, `lb`).
  • [parameters]: Arguments specific to the chosen `subcommand` (e.g., resource names, IDs).
  • [--options]: Optional flags to modify behavior or provide additional information (e.g., `--resource-group`, `--location`, `--output`).
Example usage:
az network vnet create --name MyVNet --resource-group MyResourceGroup --location eastus
az network nsg rule create --nsg-name MyNSG --resource-group MyResourceGroup --name AllowSSH --priority 100 --direction Inbound --access Allow --protocol Tcp --destination-port-ranges 22

PARAMETERS

--help
    Displays help for the command or subcommand.

--output <format>
    Specifies the output format (e.g., `json`, `jsonc`, `tsv`, `table`, `yaml`, `none`).

--query <JMESPath query>
    JMESPath query string to filter or transform output.

--verbose
    Increases logging verbosity to show debug logs.

--debug
    Increases logging verbosity to show all debug logs.

--only-show-errors
    Only show errors, suppressing warnings.

--subscription <name or ID>
    Specifies the subscription to use for the command.

--resource-group <name>
    Specifies the resource group for the command (commonly used).

--location <name>
    Specifies the Azure region for resource creation (commonly used).

--tags <key=value>
    Space-separated tags: `key[=value] key[=value] ...`

--yes / -y
    Do not prompt for confirmation.

DESCRIPTION

The `az network` command group is a fundamental component of the Azure Command-Line Interface (Azure CLI), designed for comprehensive management of networking services within Microsoft Azure. Unlike traditional standalone Linux utilities, `az network` is invoked as a subcommand of the primary `az` executable, reflecting its role in orchestrating cloud infrastructure.

It provides a rich set of subcommands for interacting with a wide array of Azure networking constructs, including but not limited to: Virtual Networks (VNet) and subnets, Network Security Groups (NSG) and their rules, Public IP addresses (PIP), Load Balancers, Application Gateways, VPN Gateways, Traffic Managers, Virtual WANs, and Firewall services. This command group is essential for cloud administrators, DevOps engineers, and developers who provision, configure, and troubleshoot network connectivity and security for their applications and services deployed on Azure. Its design allows for scripting and automation of complex networking setups, making it a critical tool for managing cloud infrastructure efficiently and programmatically. Users authenticate to Azure via `az login` before utilizing `az network` to interact with their subscription's resources.

CAVEATS

  • Azure CLI Requirement: The `az network` command is part of the Azure CLI. It must be installed and configured on your system to be used. It is not a native Linux utility.
  • Authentication: Requires prior authentication to an Azure subscription using `az login`. Commands will fail without proper authentication and permissions.
  • Internet Connectivity: Requires an active internet connection to communicate with Azure services.
  • Subscription and Permissions: The user's Azure account must have the necessary permissions within the target subscription to perform the requested networking operations.
  • Resource Group Dependency: Many networking resources are scoped within Azure Resource Groups, and commands often require specifying the `--resource-group` parameter.

OUTPUT FORMATS

The Azure CLI, including `az network` commands, supports various output formats (e.g., `json`, `table`). Using `--output table` often provides a human-readable summary, while `--output json` is ideal for scripting and automation.

INTERACTIVE MODE AND AUTOCOMPLETION

The Azure CLI offers an interactive mode (`az interactive`) and shell autocompletion for easier command discovery and usage, which greatly assists in navigating the extensive `az network` command tree.

MODULE-BASED STRUCTURE

The `az network` command group is effectively a module within the Azure CLI, allowing for focused development and maintenance of networking-specific functionalities.

HISTORY

The `az network` command group has evolved alongside the development of the Azure CLI itself, which was first released in 2015. It has undergone continuous updates and expansions to support new Azure networking services and features. As Azure's networking capabilities have grown – from basic virtual networks to complex software-defined networking, hybrid connectivity, and advanced security services – the `az network` command group has been consistently updated to provide comprehensive command-line interfaces for managing these innovations. Its development is driven by the need for programmatic control and automation of Azure infrastructure, reflecting a broader industry shift towards Infrastructure as Code (IaC) principles.

SEE ALSO

az(1): The main Azure CLI command., az login(1): Used to authenticate to Azure., az group(1): Manages Azure resource groups., az vm(1): Manages Azure virtual machines., az storage(1): Manages Azure storage accounts., az keyvault(1): Manages Azure Key Vault.

Copied to clipboard