Skip to content

Commit ebcc301

Browse files
author
sivakami
committed
attach nsg rule to subnets.
1 parent 85b4f2f commit ebcc301

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

.pipelines/swiftv2-long-running/scripts/create_nsg.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ az network nsg create -g "$RG" -n "$NSG_NAME" -l "$LOCATION" --output none \
1717

1818
echo "==> Creating NSG rule to DENY traffic from Subnet1 ($SUBNET1_PREFIX) to Subnet2 ($SUBNET2_PREFIX)"
1919
az network nsg rule create \
20-
-g "$RG" \
20+
--resource-group "$RG" \
2121
--nsg-name "$NSG_NAME" \
22-
-n deny-subnet1-to-subnet2 \
22+
--name deny-subnet1-to-subnet2 \
2323
--priority 100 \
2424
--source-address-prefixes "$SUBNET1_PREFIX" \
2525
--destination-address-prefixes "$SUBNET2_PREFIX" \
@@ -32,9 +32,9 @@ az network nsg rule create \
3232

3333
echo "==> Creating NSG rule to DENY traffic from Subnet2 ($SUBNET2_PREFIX) to Subnet1 ($SUBNET1_PREFIX)"
3434
az network nsg rule create \
35-
-g "$RG" \
35+
--resource-group "$RG" \
3636
--nsg-name "$NSG_NAME" \
37-
-n deny-subnet2-to-subnet1 \
37+
--name deny-subnet2-to-subnet1 \
3838
--priority 200 \
3939
--source-address-prefixes "$SUBNET2_PREFIX" \
4040
--destination-address-prefixes "$SUBNET1_PREFIX" \
@@ -45,4 +45,8 @@ az network nsg rule create \
4545
--output none \
4646
&& echo "[OK] Deny rule from Subnet2 → Subnet1 created."
4747

48+
az network vnet subnet update --name s1 --vnet-name cx_vnet_a1 --resource-group "$RG" --network-security-group cx_nsg_a1
49+
az network vnet subnet update --name s2 --vnet-name cx_vnet_a1 --resource-group "$RG" --network-security-group cx_nsg_a1
50+
4851
echo "NSG '$NSG_NAME' created successfully with bidirectional isolation between Subnet1 and Subnet2."
52+

0 commit comments

Comments
 (0)