File tree Expand file tree Collapse file tree 1 file changed +49
-2
lines changed
.pipelines/swiftv2-long-running/scripts Expand file tree Collapse file tree 1 file changed +49
-2
lines changed Original file line number Diff line number Diff line change 33
44SUBSCRIPTION_ID=$1
55RG=$2
6+ LOCATION=${3:- centraluseuap}
67
78VNET_A1=" cx_vnet_a1"
89S1_PREFIX=" 10.10.1.0/24"
910S2_PREFIX=" 10.10.2.0/24"
1011NSG_NAME=" ${VNET_A1} -nsg"
1112
12- az network nsg create -g " $RG " -n " $NSG_NAME " --output none
13- az network nsg rule create -g " $RG "
13+ echo " ==> Creating Network Security Group: $NSG_NAME "
14+ az network nsg create -g " $RG " -n " $NSG_NAME " -l " $LOCATION " --output none
15+
16+ echo " ==> Adding NSG rules"
17+
18+ # Allow SSH from any
19+ az network nsg rule create \
20+ -g " $RG " \
21+ --nsg-name " $NSG_NAME " \
22+ -n allow-ssh \
23+ --priority 100 \
24+ --source-address-prefixes " *" \
25+ --destination-port-ranges 22 \
26+ --direction Inbound \
27+ --access Allow \
28+ --protocol Tcp \
29+ --description " Allow SSH access" \
30+ --output none
31+
32+ # Allow internal VNet traffic
33+ az network nsg rule create \
34+ -g " $RG " \
35+ --nsg-name " $NSG_NAME " \
36+ -n allow-vnet \
37+ --priority 200 \
38+ --source-address-prefixes VirtualNetwork \
39+ --destination-address-prefixes VirtualNetwork \
40+ --direction Inbound \
41+ --access Allow \
42+ --protocol " *" \
43+ --description " Allow VNet internal traffic" \
44+ --output none
45+
46+ # Allow AKS API traffic
47+ az network nsg rule create \
48+ -g " $RG " \
49+ --nsg-name " $NSG_NAME " \
50+ -n allow-aks-controlplane \
51+ --priority 300 \
52+ --source-address-prefixes AzureCloud \
53+ --destination-port-ranges 443 \
54+ --direction Inbound \
55+ --access Allow \
56+ --protocol Tcp \
57+ --description " Allow AKS control plane traffic" \
58+ --output none
59+
60+ echo " NSG '$NSG_NAME ' created successfully with rules."
You can’t perform that action at this time.
0 commit comments