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

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.

主站蜘蛛池模板: 察雅县| 商丘市| 四会市| 青河县| 沂水县| 和硕县| 阜宁县| 蒲城县| 垫江县| 万荣县| 武城县| 县级市| 长海县| 益阳市| 化州市| 红河县| 宁晋县| 余庆县| 康定县| 兴义市| 镇远县| 日喀则市| 延吉市| 竹山县| 应城市| 确山县| 西平县| 扎鲁特旗| 杂多县| 炉霍县| 天台县| 福安市| 郴州市| 泰兴市| 和田县| 新巴尔虎左旗| 蚌埠市| 米林县| 亳州市| 鞍山市| 德昌县|