зеркало из
1
0
Форкнуть 0
0 VNet (v1)
Peter Taylor редактировал(а) эту страницу 2017-04-25 14:55:13 -07:00

Use the vnet-n-subnet building block template to deploy an Azure virtual network (VNet). This building block deploys a virtual network with no additional resources. To deploy a VNet with that includes Network Security Groups (NSGs) or User Defined Routes (UDRs), use the following building blocks:

Parameters

There is one parameter in this building block template named virtualNetworkSettings. It contains the following properties:

  • name
    Value. Required.
    Name of the VNet.
  • addressPrefixes
    Array of values. Required.
    Specifies the CIDR address blocks for the entire VNet. Supports multiple CIDR prefixes.
  • subnets
    Array of objects. Required.
    Specifies the subnets within the VNet. Subnets are specified by the following object:
    • name
      Value. Required.
      Name of the subnet.
    • addressPrefix
      Value. Required.
      CIDR address block for the subnet (must be valid within the VNet address space definition).
  • dnsServers
    Array of values. Optional.
    Specifies one or more custom DNS Server address for the VNet. Leave the array empty to use Azure internal name resolution.

Deployment

You can deploy a building block template using Azure portal, PowerShell, or Azure CLI.

Azure portal

Note that deploying via Azure Portal requires your parameter file to have a publicly available URI.

  1. Right-click the button below and select either "open link in new tab" or "open link in new window":
  2. Wait for the Azure Portal to open.
  3. In the Basics section:
  • Select your Subscription from the drop-down list.
  • For the Resource group, you can either create a new resource group or use an existing resource group.
  • Select the region where you'd like to deploy the VNet in the Location drop-down list.
  1. In the Settings section, enter a URI to a valid parameter file. There are several example parameter files in Github. Note that if you want to use one of these parameter files the URI must be the path to the raw file in Github.
  2. Review the terms and conditions, then click the I agree to the terms and conditions stated above checkbox.
  3. Click the Purchase button.
  4. Wait for the deployment to complete.

PowerShell

To deploy the building block template using a parameter file hosted at a publicly available URI, follow these steps:

  1. Upload your parameter file to a location with a publicly available URI.
  2. Log in to Azure using your selected subscription:
Login-AzureRmAccount -SubscriptionId <your subscription ID>
  1. If you do not have an existing resource group, run the New-AzureRmResourceGroup cmdlet to create one as shown below:
New-AzureRmResourceGroup -Location <Target Azure Region> -Name <Resource Group Name> 
  1. Run the New-AzureRmResourceGroupDeployment cmdlet as shown below:
New-AzureRmResourceGroupDeployment -ResourceGroupName <Resource Group Name> -TemplateUri https://raw.githubusercontent.com/mspnp/template-building-blocks/v1.0.0/scenarios/vnet-n-subnet/azuredeploy.json -templateParameterUriFromTemplate <URI of parameter file>

Example
The cmdlet below creates a resource group named app1-rg in the westus region, then deploys the vnet-multiple-subnet-dns parameter file from the scenarios folder in Github.

Login-AzureRmAccount -SubscriptionId <your subscription ID>
New-AzureRmResourceGroup -Location westus -Name app1-rg
New-AzureRmResourceGroupDeployment -ResourceGroupName app1-rg -TemplateUri https://raw.githubusercontent.com/mspnp/template-building-blocks/v1.0.0/scenarios/vnet-n-subnet/azuredeploy.json -templateParameterUriFromTemplate https://raw.githubusercontent.com/mspnp/template-building-blocks/v1.0.0/scenarios/vnet-n-subnet/parameters/vnet-multiple-subnet-dns.parameters.json

Azure CLI

Before you begin, install the latest version of the Azure CLI.

To deploy the building block template using a parameter file hosted at a publicly available URI, follow these steps:

  1. Upload your parameter file to a location with a publicly available URI.
  2. Log in to Azure using your selected subscripton:
az login
  1. Set your selected subscription:
az account set --subscription <your subscripton ID>
  1. If you do not have an existing resource group, create a new one using the following command:
az group create -l <Target Azure Region> -n <Resource Group Name> 
  1. Run the command below to deploy the VNet:
az group deployment create -g <Resource Group Name> --template-uri https://raw.githubusercontent.com/mspnp/template-building-blocks/v1.0.0/scenarios/vnet-n-subnet/azuredeploy.json --parameters "{\"templateParameterUri\":{\"value\":\"<parameter file public URI>\"}}"

Example
The command below creates a resource group named app1-rg in the westus region, then deploys the vnet-multiple-subnet-dns parameter file from the scenarios folder in Github.

az login
az group create -l "westus" -n "app1-rg"
az group deployment create -g app1-rg --template-uri https://raw.githubusercontent.com/mspnp/template-building-blocks/v1.0.0/scenarios/vnet-n-subnet/azuredeploy.json --parameters "{\"templateParameterUri\":{\"value\":\"https://raw.githubusercontent.com/mspnp/template-building-blocks/v1.0.0/scenarios/vnet-n-subnet/parameters/vnet-multiple-subnet-dns.parameters.json\"}}"