az acr network-rule

Manage network rules for Azure Container Registries.

Commands

az acr network-rule add Add a network rule.
az acr network-rule list List network rules.
az acr network-rule remove Remove a network rule.

az acr network-rule add

Add a network rule.

az acr network-rule add --name
[--ip-address]
[--resource-group]
[--subnet]
[--subscription]
[--vnet-name]

Examples

Add a rule to allow access for a subnet in the same resource group as the registry.

az acr network-rule add -n MyRegistry --vnet-name myvnet --subnet mysubnet

Add a rule to allow access for a subnet in a different subscription or resource group.

az acr network-rule add -n MyRegistry --subnet /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/mysubnet

Add a rule to allow access for a specific IP address-range.

az acr network-rule add -n MyRegistry --ip-address 23.45.1.0/24

Required Parameters

--name -n

The name of the container registry. You can configure the default registry name using az configure --defaults acr=<registry name>.

Optional Parameters

--ip-address

IPv4 address or CIDR range.

--resource-group -g

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

--subnet

Name or ID of subnet. If name is supplied, --vnet-name must be supplied.

--subscription

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

--vnet-name

Name of a virtual network.

az acr network-rule list

List network rules.

az acr network-rule list --name
[--resource-group]
[--subscription]

Examples

List network rules for a registry.

az acr network-rule list -n MyRegistry

Required Parameters

--name -n

The name of the container registry. You can configure the default registry name using az configure --defaults acr=<registry name>.

Optional Parameters

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

az acr network-rule remove

Remove a network rule.

az acr network-rule remove --name
[--ip-address]
[--resource-group]
[--subnet]
[--subscription]
[--vnet-name]

Examples

Remove a rule that allows access for a subnet in the same resource group as the registry.

az acr network-rule remove -n MyRegistry --vnet-name myvnet --subnet mysubnet

Remove a rule that allows access for a subnet in a different subscription or resource group.

az acr network-rule remove -n MyRegistry --subnet /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/mysubnet

Remove a rule that allows access for a specific IP address-range.

az acr network-rule remove -n MyRegistry --ip-address 23.45.1.0/24

Required Parameters

--name -n

The name of the container registry. You can configure the default registry name using az configure --defaults acr=<registry name>.

Optional Parameters

--ip-address

IPv4 address or CIDR range.

--resource-group -g

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

--subnet

Name or ID of subnet. If name is supplied, --vnet-name must be supplied.

--subscription

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

--vnet-name

Name of a virtual network.