Κοινή χρήση μέσω


az stack-hci-vm network nsg rule

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 nsg rule command. Learn more about extensions.

Manage network security group rules.

Commands

Name Description Type Status
az stack-hci-vm network nsg rule create

Create a network security group rule.

Extension GA
az stack-hci-vm network nsg rule delete

Delete a network security group rule.

Extension GA
az stack-hci-vm network nsg rule list

List all rules in a network security group.

Extension GA
az stack-hci-vm network nsg rule show

Get the details of a network security group rule.

Extension GA
az stack-hci-vm network nsg rule update

Update a network security group rule.

Extension GA

az stack-hci-vm network nsg rule create

Create a network security group rule.

az stack-hci-vm network nsg rule create --custom-location
                                        --name
                                        --nsg-name
                                        --priority
                                        --resource-group
                                        [--access {Allow, Deny}]
                                        [--description]
                                        [--destination-address-prefixes]
                                        [--destination-port-ranges]
                                        [--direction {Inbound, Outbound}]
                                        [--location]
                                        [--polling-interval]
                                        [--protocol {*, Icmp, Tcp, Udp}]
                                        [--source-address-prefixes]
                                        [--source-port-ranges]

Examples

Create a basic "Allow" NSG rule with the highest priority.

az stack-hci-vm network nsg rule create -g MyResourceGroup --nsg-name MyNsg -n MyNsgRule --priority 100 --custom-location $customLocationId

Required Parameters

--custom-location

The ID of the extended location.

--name -n

Name of the network security group rule.

--nsg-name

Name of the network security group.

--priority

Priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.

--resource-group -g

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

Optional Parameters

--access

Network traffic is allowed or denied.

Accepted values: Allow, Deny
Default value: Allow
--description

Description for this rule. Restricted to 140 chars.

--destination-address-prefixes

The destination address prefixes. CIDR or destination IP ranges.

Default value: ['*']
--destination-port-ranges

The destination port ranges. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.

Default value: ['80']
--direction

Direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.

Accepted values: Inbound, Outbound
Default value: Inbound
--location -l

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

--polling-interval

ARM polling interval for long running operations.

--protocol

Network protocol this rule applies to.

Accepted values: *, Icmp, Tcp, Udp
Default value: *
--source-address-prefixes

The CIDR or source IP ranges.

Default value: ['*']
--source-port-ranges

The source port ranges. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.

Default value: ['*']
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--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.

az stack-hci-vm network nsg rule delete

Delete a network security group rule.

az stack-hci-vm network nsg rule delete --name
                                        --nsg-name
                                        --resource-group
                                        [--polling-interval]
                                        [--yes]

Examples

Delete a network security group rule

az stack-hci-vm network nsg rule delete -g MyResourceGroup --nsg-name MyNsg -n MyNsgRule

Required Parameters

--name -n

Name of the network security group rule.

--nsg-name

Name of the network security group.

--resource-group -g

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

Optional Parameters

--polling-interval

ARM polling interval for long running operations.

--yes -y

Do not prompt for confirmation.

Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--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.

az stack-hci-vm network nsg rule list

List all rules in a network security group.

az stack-hci-vm network nsg rule list --nsg-name
                                      --resource-group

Examples

List all rules in a network security group

az stack-hci-vm network nsg rule list -g MyResourceGroup --nsg-name MyNsg

Required Parameters

--nsg-name

Name of the network security group.

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

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--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.

az stack-hci-vm network nsg rule show

Get the details of a network security group rule.

az stack-hci-vm network nsg rule show --nsg-name
                                      [--ids]
                                      [--name]
                                      [--resource-group]
                                      [--subscription]

Examples

Get the details of a network security group rule

az stack-hci-vm network nsg rule show -g MyResourceGroup --nsg-name MyNsg -n MyNsgRule

Required Parameters

--nsg-name

Name of the network security group.

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the network security group rule.

--resource-group -g

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

--subscription

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--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.

az stack-hci-vm network nsg rule update

Update a network security group rule.

az stack-hci-vm network nsg rule update --name
                                        --nsg-name
                                        --resource-group
                                        [--access {Allow, Deny}]
                                        [--add]
                                        [--description]
                                        [--destination-address-prefixes]
                                        [--destination-port-ranges]
                                        [--direction {Inbound, Outbound}]
                                        [--force-string]
                                        [--polling-interval]
                                        [--priority]
                                        [--protocol {*, Icmp, Tcp, Udp}]
                                        [--remove]
                                        [--set]
                                        [--source-address-prefixes]
                                        [--source-port-ranges]

Examples

Update an NSG rule with a new wildcard destination address prefix

az stack-hci-vm network nsg rule update -g MyResourceGroup --nsg-name MyNsg -n MyNsgRule --destination-address-prefix '*'

Update a network security group rule

az stack-hci-vm network nsg rule update --name MyNsgRule --nsg-name MyNsg --resource-group MyResourceGroup --source-address-prefixes 208.130.28/24

Required Parameters

--name -n

Name of the network security group rule.

--nsg-name

Name of the network security group.

--resource-group -g

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

Optional Parameters

--access

Network traffic is allowed or denied.

Accepted values: Allow, Deny
--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>.

Default value: []
--description

Description for this rule. Restricted to 140 chars.

--destination-address-prefixes

The destination address prefixes. CIDR or destination IP ranges.

--destination-port-ranges

The destination port ranges. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.

--direction

Direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.

Accepted values: Inbound, Outbound
--force-string

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

Default value: False
--polling-interval

ARM polling interval for long running operations.

--priority

Priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.

--protocol

Network protocol this rule applies to.

Accepted values: *, Icmp, Tcp, Udp
--remove

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

Default value: []
--set

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

Default value: []
--source-address-prefixes

The CIDR or source IP ranges.

--source-port-ranges

The source port ranges. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--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.