|
| 1 | +--- |
| 2 | +title: Azure Operator Nexus Access Control Lists Examples |
| 3 | +description: Examples of configuring and creating Azure Operator Nexus Access Control Lists. |
| 4 | +author: joemarshallmsft |
| 5 | +ms.author: joemarshall |
| 6 | +ms.service: azure-operator-nexus |
| 7 | +ms.topic: reference |
| 8 | +ms.date: 02/09/2024 |
| 9 | +--- |
| 10 | + |
| 11 | +# Access Control List Creation and Configuration Examples |
| 12 | + |
| 13 | +This article gives examples of how to create and update Access Control Lists (ACLS). |
| 14 | + |
| 15 | +## Overview of the ACL create flow |
| 16 | + |
| 17 | +Creating an Access Control List (ACL) associated with a Network-to-Network Interconnect (NNI) involves these steps: |
| 18 | + |
| 19 | +- Create a Network Fabric resource and add an NNI child resource to it. |
| 20 | + |
| 21 | +- Create ingress and egress ACL resources using the `az networkfabric acl create` command. You can provide match configurations and the default action for the ACL. You can also provide dynamic match configurations either inline, or in a file stored in your Azure storage account blob container. |
| 22 | + |
| 23 | +- Update the NNI resource with the ingress and egress ACL IDs using the `az networkfabric nni update` command. You need to provide valid ACL resource IDs in the `--ingress-acl-id` and `--egress-acl-id` parameters. |
| 24 | + |
| 25 | +- Provision the Network Fabric resource using the `az networkfabric fabric provision` command. This generates the base configuration and the dynamic match configuration for the ACLs and sends them to the devices. |
| 26 | + |
| 27 | +## Overview of the ACL update flow |
| 28 | + |
| 29 | +- Create ingress and egress ACL resources using `az networkfabric acl create` as described in the previous section. |
| 30 | + |
| 31 | +- Update the ingress or egress ACL using the `az networkfabric acl update` command. |
| 32 | + |
| 33 | +- Verify the configuration state of the ACL is `accepted`. |
| 34 | + |
| 35 | +- Verify the configuration state of the fabric is `accepted`. |
| 36 | + |
| 37 | +- Execute Fabric Commit to update the ACL. |
| 38 | + |
| 39 | +## Example commands |
| 40 | + |
| 41 | +### Access Control list on a Network-to-Network Interconnect |
| 42 | + |
| 43 | +This example shows you how to create an NNI with two ACLs - one for ingress and one for egress. |
| 44 | + |
| 45 | +The ACLs must be applied before provisioning the Network Fabric. This limitation is temporary and will be removed in future release. The ingress and egress ACLs are created before the NNI resource and referenced when the NNI is created, which also triggers the creation of the ACLs. This configuration must be done before provisioning the network fabric. |
| 46 | + |
| 47 | +#### Create ingress ACL: example command |
| 48 | + |
| 49 | +```azurecli |
| 50 | +az networkfabric acl create \ |
| 51 | + --resource-group "example-rg" |
| 52 | + --location "eastus2euap" \ |
| 53 | + --resource-name "example-Ipv4ingressACL" \ |
| 54 | + --configuration-type "Inline" \ |
| 55 | + --default-action "Permit" \ |
| 56 | + --dynamic-match-configurations "[{ipGroups:[{name:'example-ipGroup',ipAddressType:IPv4,ipPrefixes:['10.20.3.1/20']}],vlanGroups:[{name:'example-vlanGroup',vlans:['20-30']}],portGroups:[{name:'example-portGroup',ports:['100-200']}]}]" \ |
| 57 | + --match-configurations "[{matchConfigurationName:'example-match',sequenceNumber:123,ipAddressType:IPv4,matchConditions:[{etherTypes:['0x1'],fragments:['0xff00-0xffff'],ipLengths:['4094-9214'],ttlValues:[23],dscpMarkings:[32],portCondition:{flags:[established],portType:SourcePort,layer4Protocol:TCP,ports:['1-20']},protocolTypes:[TCP],vlanMatchCondition:{vlans:['20-30'],innerVlans:[30]},ipCondition:{type:SourceIP,prefixType:Prefix,ipPrefixValues:['10.20.20.20/12']}}],actions:[{type:Count,counterName:'example-counter'}]}]" |
| 58 | +``` |
| 59 | + |
| 60 | +#### Create egress ACL: example command |
| 61 | + |
| 62 | +```azurecli |
| 63 | +az networkfabric acl create \ |
| 64 | + --resource-group "example-rg" \ |
| 65 | + --location "eastus2euap" \ |
| 66 | + --resource-name "example-Ipv4egressACL" \ |
| 67 | + --configuration-type "File" \ |
| 68 | + --acls-url "https://ACL-Storage-URL" \ |
| 69 | + --default-action "Permit" \ |
| 70 | + --dynamic-match-configurations "[{ipGroups:[{name:'example-ipGroup',ipAddressType:IPv4,ipPrefixes:['10.20.3.1/20']}],vlanGroups:[{name:'example-vlanGroup',vlans:['20-30']}],portGroups:[{name:'example-portGroup',ports:['100-200']}]}]" |
| 71 | +``` |
| 72 | + |
| 73 | +### Access Control List on an isolation domain external network |
| 74 | + |
| 75 | +Use the `az networkfabric acl create` command to create ingress and egress ACLs for the external network. In the example, we specify the resource group, name, location, network fabric ID, external network ID, and other parameters. You can also specify the match conditions and actions for the ACL rules using the `--match` and `--action` parameters. |
| 76 | + |
| 77 | +This command creates an ingress ACL named `acl-ingress` that allows ICMP traffic from any source to the external network: |
| 78 | + |
| 79 | +```azurecli |
| 80 | +az networkfabric acl create \ |
| 81 | + --resource-group myResourceGroup \ |
| 82 | + --name acl-ingress \ |
| 83 | + --location eastus \ |
| 84 | + --network-fabric-id /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.NetworkFabric/networkFabrics/myNetworkFabric \ |
| 85 | + --external-network-id /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.NetworkFabric/externalNetworks/ext-net \ |
| 86 | + --match "ip protocol icmp" \ |
| 87 | + --action allow |
| 88 | +``` |
| 89 | + |
| 90 | +Use the `az networkfabric externalnetwork update` command to update the external network with the resource group, name, and network fabric ID. You also need to specify the ingress and egress ACL IDs using the `--ingress-acl-id` and `--egress-acl-id` parameters. For example, the following command updates the external network named `ext-net` to reference the ingress ACL named `acl-ingress`: |
| 91 | + |
| 92 | +```azurecli |
| 93 | +az networkfabric externalnetwork update \ |
| 94 | + --resource-group myResourceGroup \ |
| 95 | + --name ext-net \ |
| 96 | + --network-fabric-id /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.NetworkFabric/networkFabrics/myNetworkFabric \ |
| 97 | + --ingress-acl-id /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.NetworkFabric/acls/acl-ingress |
| 98 | +``` |
| 99 | + |
| 100 | +### More example scenarios and commands |
| 101 | + |
| 102 | +To create an egress ACL for an NNI that denies all traffic except for HTTP and HTTPS, you can use this command: |
| 103 | + |
| 104 | +```azurecli |
| 105 | +az networkfabric acl create \ |
| 106 | + --name acl-egress \ |
| 107 | + --resource-group myResourceGroup \ |
| 108 | + --nni-id /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.NetworkFabric/networkInterfaces/myNni \ |
| 109 | + --match "ip protocol tcp destination port 80 or 443" \ |
| 110 | + --action allow \ |
| 111 | + --default-action deny |
| 112 | +``` |
| 113 | + |
| 114 | +To update an existing ACL to add a new match condition and action, you can use this command: |
| 115 | + |
| 116 | +```azurecli |
| 117 | +az networkfabric acl update \ |
| 118 | + --name acl-ingress \ |
| 119 | + --resource-group myResourceGroup \ |
| 120 | + --match "ip protocol icmp" \ |
| 121 | + --action allow \ |
| 122 | + --append-match-configurations |
| 123 | +``` |
| 124 | + |
| 125 | +To list all the ACLs in a resource group, you can use this command: |
| 126 | + |
| 127 | +```azurecli |
| 128 | +az networkfabric acl list --resource-group myResourceGroup |
| 129 | +``` |
| 130 | + |
| 131 | +To show the details of a specific ACL, you can use this command: |
| 132 | + |
| 133 | +```azurecli |
| 134 | +az networkfabric acl show \ |
| 135 | + --name acl-ingress \ |
| 136 | + --resource-group myResourceGroup |
| 137 | +``` |
| 138 | + |
| 139 | +To delete an ACL, you can use this command: |
| 140 | + |
| 141 | +```azurecli |
| 142 | +az networkfabric acl delete \ |
| 143 | + --name acl-egress \ |
| 144 | + --resource-group myResourceGroup |
| 145 | +``` |
| 146 | + |
0 commit comments