官术网_书友最值得收藏!

Creating a virtual network in Azure portal using PowerShell

To be able to run your PowerShell cmdlets against Azure successfully, you need to log in first to Azure using the following cmdlet:

Login-AzureRMAccount

Then, you will be prompted to enter the credentials of your Azure account. Voila! You are logged in and you can run Azure PowerShell cmdlets successfully.

To create an Azure VNet, you first need to create the subnets that will be attached to this virtual network. Therefore, let's get started by creating the subnets:

$NSubnet = New-AzureRMVirtualNetworkSubnetConfig –Name NSubnet -AddressPrefix 192.168.1.0/24
$GWSubnet = New-AzureRMVirtualNetworkSubnetConfig –Name GatewaySubnet -AddressPrefix 192.168.2.0/27

Now you are ready to create a virtual network by triggering the following cmdlet:

New-AzureRMVirtualNetwork -ResourceGroupName PacktPub -Location WestEurope -Name PSVNet -AddressPrefix 192.168.0.0/16 -Subnet $NSubnet,$GWSubnet

Congratulations! You have your virtual network up and running with two subnets associated to it, one of them is a gateway subnet.

主站蜘蛛池模板: 五原县| 舟曲县| 星子县| 增城市| 兴文县| 房山区| 红安县| 安岳县| 镇安县| 南昌市| 长春市| 凌海市| 邢台县| 枣阳市| 吉首市| 清丰县| 北碚区| 噶尔县| 玛沁县| 宁陵县| 襄汾县| 南康市| 韩城市| 巩义市| 宁安市| 新丰县| 聊城市| 梨树县| 贵阳市| 广安市| 区。| 海门市| 明溪县| 建始县| 新竹市| 广元市| 明溪县| 潞城市| 西贡区| 阜平县| 黄冈市|