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

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.

主站蜘蛛池模板: 兴国县| 西昌市| 崇左市| 雷山县| 嘉定区| 化德县| 南溪县| 繁峙县| 汕头市| 荃湾区| 玉龙| 鄱阳县| 拜城县| 茶陵县| 米脂县| 改则县| 车险| 盱眙县| 盐池县| 桦南县| 兴宁市| 涿鹿县| 朔州市| 额尔古纳市| 大竹县| 六枝特区| 高唐县| 汝城县| 烟台市| 徐汇区| 陆川县| 通城县| 桐庐县| 四子王旗| 富锦市| 仲巴县| 应城市| 信阳市| 桦甸市| 同德县| 青海省|