Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Create a subnet configuration
- $Subnet = New-AzureRmVirtualNetworkSubnetConfig -Name default -AddressPrefix 192.168.1.0/24
- # Create a virtual network
- $VNet = New-AzureRmVirtualNetwork -ResourceGroupName $ResourceGroup -Location $Location -Name vnet-$Location -AddressPrefix $Subnet.AddressPrefix -Subnet $Subnet
- # Create a public IP address and specify a DNS name
- $PublicIP = New-AzureRmPublicIpAddress -ResourceGroupName $ResourceGroup -Location $Location -Name "$name-$Location-pip" -AllocationMethod Dynamic
- # Create an inbound network security group rule for port 3389
- $VNetNSGRuleRDP = New-AzureRmNetworkSecurityRuleConfig -Name "Allow-Inbound-RDP" -Protocol Tcp -Direction Inbound -Priority 1000 -SourceAddressPrefix * -SourcePortRange * -DestinationAddressPrefix * -DestinationPortRange 3389 -Access Allow
- # Create a network security group
- $NSG = New-AzureRmNetworkSecurityGroup -ResourceGroupName $ResourceGroup -Location $Location -Name "nsg-$Location" -SecurityRules $VNetNSGRuleRDP
- # Create a virtual network card and associate with public IP address and NSG
- $nic = New-AzureRmNetworkInterface -Name $name-nic -ResourceGroupName $ResourceGroup -Location $Location -SubnetId $vnet.Subnets[0].Id -PublicIpAddressId $PublicIP.Id -NetworkSecurityGroupId $nsg.Id
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement