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

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.

主站蜘蛛池模板: 崇阳县| 漳浦县| 堆龙德庆县| 托里县| 故城县| 张家口市| 龙门县| 获嘉县| 高青县| 武宁县| 栾城县| 南涧| 广平县| 大新县| 尤溪县| 奉化市| 桃园县| 云浮市| 永吉县| 紫阳县| 四会市| 房产| 东莞市| 北京市| 青神县| 乌兰察布市| 林州市| 博湖县| 柳州市| 长武县| 唐河县| 延津县| 洞口县| 维西| 徐汇区| 古丈县| 江津市| 长葛市| 郸城县| 汉寿县| 达州市|