az network nsg

Manage network security groups.

Commands

Name Description Type Status
az network nsg create

Create a network security group.

Core Preview
az network nsg delete

Delete a network security group.

Core Preview
az network nsg list

List network security groups.

Core Preview
az network nsg show

Show a network security group.

Core Preview

az network nsg create

Preview

Create a network security group.

Create an Azure network security group. When --location is omitted, the resource group's location is used.

az network nsg create --name
                      --resource-group
                      [--location]
                      [--profile]
                      [--subscription-id]
                      [--tags]

Examples

Create a network security group with tags

az network nsg create --name my-nsg --resource-group my-rg --location eastus --tags owner=network env=test

Create in the resource group's location

az network nsg create --name my-nsg --resource-group my-rg

Required Parameters

--name -n

The name of the network security group.

--resource-group -g

The resource group 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.

--location -l

Location for the network security group. Defaults to the resource group's location.

--profile

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

--subscription-id

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

--tags

Resource tags in KEY=VALUE form (space-separated).

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 nsg delete

Preview

Delete a network security group.

Delete an Azure network security group.

az network nsg delete --name
                      --resource-group
                      [--profile]
                      [--subscription-id]

Examples

Delete a network security group

az network nsg delete --name my-nsg --resource-group my-rg

Required Parameters

--name -n

The name of the network security group.

--resource-group -g

The resource group 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 nsg list

Preview

List network security groups.

List network security groups in a resource group, or omit the resource group to list across the subscription.

az network nsg list [--profile]
                    [--resource-group]
                    [--subscription-id]

Examples

List network security groups in a resource group

az network nsg list --resource-group my-rg

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

--resource-group -g

The resource group name. Omit to list every network security group in the subscription.

--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 nsg show

Preview

Show a network security group.

Retrieve a single Azure network security group.

az network nsg show --name
                    --resource-group
                    [--expand]
                    [--profile]
                    [--subscription-id]

Examples

Show a network security group

az network nsg show --name my-nsg --resource-group my-rg

Expand the associated network interfaces

az network nsg show --name my-nsg --resource-group my-rg --expand networkInterfaces

Required Parameters

--name -n

The name of the network security group.

--resource-group -g

The resource group 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. networkInterfaces or subnets.

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