Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. # Create a subnet configuration
  2. $Subnet = New-AzureRmVirtualNetworkSubnetConfig -Name default -AddressPrefix 192.168.1.0/24
  3.  
  4. # Create a virtual network
  5. $VNet = New-AzureRmVirtualNetwork -ResourceGroupName $ResourceGroup -Location $Location -Name vnet-$Location -AddressPrefix $Subnet.AddressPrefix -Subnet $Subnet
  6.  
  7. # Create a public IP address and specify a DNS name
  8. $PublicIP = New-AzureRmPublicIpAddress -ResourceGroupName $ResourceGroup -Location $Location -Name "$name-$Location-pip" -AllocationMethod Dynamic
  9.  
  10. # Create an inbound network security group rule for port 3389
  11. $VNetNSGRuleRDP = New-AzureRmNetworkSecurityRuleConfig -Name "Allow-Inbound-RDP" -Protocol Tcp -Direction Inbound -Priority 1000 -SourceAddressPrefix * -SourcePortRange * -DestinationAddressPrefix * -DestinationPortRange 3389 -Access Allow
  12.  
  13. # Create a network security group
  14. $NSG = New-AzureRmNetworkSecurityGroup -ResourceGroupName $ResourceGroup -Location $Location -Name "nsg-$Location" -SecurityRules $VNetNSGRuleRDP
  15.  
  16. # Create a virtual network card and associate with public IP address and NSG
  17. $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