■ 가상 머신 확장 집합에서 애플리케이션 트래픽을 허용하는 방법을 보여준다.
▶ 실행 명령
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
################################################## # 가상 머신 확장 집합을 구한다. ################################################## $vmss = Get-AzVmss -ResourceGroupName TestResourceGroup -VMScaleSetName TestScaleSet ################################################## # 80번 포트를 허용하는 규칙을 생성한다. ################################################## $testNSRuleConfig = New-AzNetworkSecurityRuleConfig ` -Name TestNSRuleConfig ` -Protocol Tcp ` -Direction Inbound ` -Priority 200 ` -SourceAddressPrefix * ` -SourcePortRange * ` -DestinationAddressPrefix * ` -DestinationPortRange 80 ` -Access Allow ################################################## # 네트워크 보안 그룹을 생성한다. ################################################## $testNSG = New-AzNetworkSecurityGroup ` -ResourceGroupName TestResourceGroup ` -Location EastUS ` -Name TestNSG ` -SecurityRules $testNSRuleConfig ################################################## # 가상 네트워크를 구한다. ################################################## $vnet = Get-AzVirtualNetwork -ResourceGroupName TestResourceGroup -Name TestVNet ################################################## # 서브넷을 구한다. ################################################## $testSubnet = $vnet.Subnets[0] ################################################## # 가상 네트워크의 서브넷을 설정한다. ################################################## $testSubnetConfig = Set-AzVirtualNetworkSubnetConfig ` -VirtualNetwork $vnet ` -Name TestSubnet ` -AddressPrefix $testSubnet.AddressPrefix ` -NetworkSecurityGroup $testNSG ################################################## # 가상 네트워크를 설정한다. ################################################## Set-AzVirtualNetwork -VirtualNetwork $vnet ################################################## # 가상 머신 확장 집합을 업데이트 한다. ################################################## Update-AzVmss ` -ResourceGroupName TestResourceGroup ` -Name TestScaleSet ` -VirtualMachineScaleSet $vmss ※ TestResourceGroup : 리소스 그룹명 TestScaleSet : 가상 머신 확장 집합명 TestNSRuleConfig : 네트워크 보안 규칙 구성명 EastUS : 지역명 TestNSG : 네트워크 보안 그룹명 TestVNet : 가상 네트워크명 TestSubnet : 서브넷명 |