Skip to content

Virtual Machines

Peter Taylor edited this page Nov 29, 2018 · 14 revisions

The VirtualMachine JSON object is used in an Azure Building Blocks parameter file to deploy an Azure virtual machine. You can use this building block to optionally deploy a load balancer or an application gateway. It has the following schema:

  • type
    String. Required.
    Must be set to VirtualMachine.
  • resourceGroupName
    String. Optional.
    Specifies the name of the resource group where the virtual machine is deployed. Only used if a resource group is not specified with the -g or --resource-group option using the Template Building Block command line.
  • subscriptionId
    String. Optional.
    Specifies the ID of the subscription where the resource group indicated above is deployed. Only used if a subscription ID is not specified with the -s or --subscription-id option using the Template Building Block command line.
  • settings
    Object. Required.
    Specifies the virtual machine settings. These settings are specified using the following object:
    • vmCount
      Integer. Optional.
      Default: 1
      The number of VMs to create using this configuration.
    • virtualNetwork
      Object. Required.
      Specifies the virtual network for the virtual machine. These settings are specified using the following object:
      • name
        String. Required.
        The name of the virtual network.
      • subscriptionId
        String. Optional.
        The Subscription ID for the subscription that includes the virtual network specified by name in the name field. If not given, the virtual network is assumed to be in the same subscription as the virtual machine.
      • resourceGroupName
        String. Optional.
        The name of the resource group that includes the virtual network specified by the name in the name field. If not given, the virtual network is assumed to be in the same resource group as the virtual machine.
    • namePrefix
      String. Required.
      Azure VM resource names are calculated in the template building blocks. The name prefix specifies a string value to prepend to -vm<n> (where n corresponds to the order in which the VM was created). For example, if the namePrefix is set to accounting and vmCount is set to 2, the first VM is named accounting-vm1 and the second VM is named accounting-vm2.
    • computerNamePrefix
      String. Optional.
      As with the namePrefix property, the computer name (i.e., host name) for each virtual machine's operating system is calculated. The computerNamePrefix specifies a string value to prepend to <n> (where n corresponds to the order in which the VM was created). For example, if the computerNamePrefix is set to accounting and vmCount is set to 2, the first VM is named accounting1 and the second VM is named accounting2. If computerNamePrefix is not specified, the value of namePrefix is used.
    • size
      String. Optional.
      Default: Standard_DS2_v2
      Indicates what size of VMs to create. This value is listed in the Size column of the table describing each VM type in the sizes for Linux virtual machines in Azure document. Note that this template creates premium storage accounts and only supports VM sizes that support premium storage. For more information, see High-performance premium storage and managed disks for VMs: Supported VMs.
    • osType
      String. Required.
      Valid values: linux | windows
      Specifies a default for the imageReference property based on operating system, as follows:
      • linux windows
        publisher: Canonical publisher: MicrosoftWindowsServer
        offer: UbuntuServer offer: WindowsServer
        sku: 16.04-LTS sku: 2016-Datacenter
        version: latest version: latest
    • imageReference
      Object. Optional.
      Specifies the OS image for the VM. For custom images, the image can contain multiple disks to be used as data disks.As discussed in the osType property description, use this property to override the default OS image. The OS image is specified by the following object:
      • id
        Required (for custom images), or Optional (for platform or marketplace images). Specifies the resource identifier of a virtual machine image in your subscription. This element is only used for virtual machine images, not platform images or marketplace images.
      • publisher
        String. Required if imageReference object is specified.
        Publisher of the OS. Note that valid strings for this value as well as the next three values can be obtained using the Azure CLI or PowerShell.
      • offer
        String. Required if imageReference object is specified.
        OS offer.
      • sku
        String. Required if imageReference object is specified.
        OS Product SKU.
      • version
        String. Required if imageReference object specified.
        OS version. Set this to latest to use the latest version of the OS.
    • adminUsername
      String. Required.
      Administrator user name for the VM operating system (OS). Note that if you use this template in a production environment, you should store these parameter files in a secure location to prevent disclosure of the administrator user name.
    • adminPassword
      String. Required for osType: windows, and for osType: linux if no sshPublicKey is specified.
      Administrator password for the VM OS. Note that if you use this template in a production environment, you should store these parameter files in a secure location to prevent disclosure of the administrator password.
    • sshPublicKey
      String. Required for osType: linux if no adminPassword is specified.
      SSH key for the VM OS Administrator account. Note that if you use this template in a production environment, you should store these parameter files in a secure location to prevent disclosure of the SSH key.
    • nics
      Array of objects. Required (at least one object).
      Specifies configuration settings for one or more network interfaces (NICs) attached to the VM. The settings for each network interface are specified using the following object:
      • isPublic
        String. Optional.
        Valid values: true | false
        Default: true
        If set to true, creates and assigns a public IP address resource to the NIC.
      • subnetName
        String. Required.
        Specifies the name of the subnet that the NIC is attached to.
      • privateIPAllocationMethod
        String. Optional.
        Valid values: Static | Dynamic
        Default: Dynamic Specifies how the private IP address is allocated.
      • privateIPAddressVersion
        String. Optional.
        Valid values: IPv4 | IPv6
        Default: IPv4
        Protocol for private IP addressing.
      • publicIPAllocationMethod
        String. Optional.
        Valid values: Static | Dynamic
        Default: Dynamic Specifies how the public IP address is allocated.
      • startingIPAddress
        String. Required if either publicIPAllocationMethod or privateIPAllocationMethod is set to Static.
        Specifies the IP address assigned to the NIC created during deployment. The IP address for subsequent NICs are incremented by one. For example, if this is set to 10.0.0.0, the first NIC will have an IP address of 10.0.0.0, the second NIC will have an IP address of 10.0.0.1, the third NIC will have an IP address of 10.0.0.2, and so on.
      • enableIPForwarding
        String. Optional.
        Valid values: true | false
        Default: false
        Specifies whether the NIC will forward IP traffic. For more information, see Enable or disable IP forwarding.
      • dnsServers
        Array of strings. Optional.
        Specifies one or more custom DNS server addresses for the NIC. Omit to use Azure internal name resolution.
      • isPrimary
        String. Optional.
        Valid values: true | false
        Default: true
        Set to true if this is the primary NIC for the VM, otherwise set to false.
      • domainNameLabelPrefix
        String. Optional.
        Creates an A record for the public IP in the Microsoft Azure DNS system based on the name.
      • backendPoolNames
        Array of strings. Optional. Assign NICs to a list of backend pools specified in loadBalancerSettings.
      • inboundNatRulesNames
        Array of strings. Optional.
        Assign NICs to a list of inbound network translation rules specified in loadBalancerSettings.
    • osDisk
      Object. Optional.
      Specifies configuration settings for the VM OS disk. If not specified, the default values indicated below will be used. The OS disk properties are specified using the following object:
      • createOption
        String. Optional.
        Valid values: fromImage | attach
        Default: fromImage
        Specifies how the OS disk for each VM is created.
        For managed disks: If set to fromImage, the OS disk of each VM created by the VirtualMachine block will be created from a single managed disk resource referenced in the imageReference parameter. If set to attach, managed disk resources specified in the images array will be attached as the OS disk for the VMs.
        For unmanaged disks: For either fromImage or attach, the OS disk of each VM created will be either created or attached from a VHD image stored in Azure blob storage and referenced in the images array property below.
      • caching
        String. Required.
        Valid values: ReadOnly | ReadWrite | None
        Default: ReadWrite
        Specifies the type of caching for the OS disk. ReadOnly sets write through caching, ReadWrite sets write back caching, and None sets no caching.
      • diskSizeGB
        Integer. Optional.
        Default: 127 (if osType is windows) or 30 (if osType is linux).
        OS disk size in GB.
      • images
        Array of strings. One string required.
        Specifies a list of virtual disk references to use for the OS disk, based on specified OS disk createOption (see above). If createOption is set to attach, the number of elements in the images array must equal the vmCount specified, and each item in the array must be unique.
        For managed disks: If createOption is set to attach, the images array must contain the fully qualified paths to the managed disk resources to attach, one item per VM created (as specified by vmCount). If createOption is set to fromImage, this property should not be included for managed disks.
        For unmanaged disks: If createOption is set to attach, the images array must contain the fully qualified paths to the unmanaged disk images, one item per VM created (as specified by vmCount). If createOption is set to fromImage, the images array should include only one unmanaged disk image to use for all the VMs created.
    • dataDisks
      Object. Optional.
      Specifies the properties for data disks to create for the VMs. The data disk properties are specified using the following object:
      • count
        Integer. Optional.
        Default: 0
        The number of data disks to create for each VM.
      • caching
        String. Optional.
        Valid values: ReadOnly | ReadWrite | None
        Default: None
        Indicates the cache setting for the data disk. Specify ReadOnly for write-through caching, ReadWrite for write-back caching, and None for no caching.
      • createOption
        String. Optional.
        Valid value: Empty
        Specifies the type of data disk created. To create one or more empty data disks, set to Empty and specify the number of disks with the count property. To attach existing data disks or create data disks from an existing image, use the disks property below.
      • diskSizeGB
        Integer. Optional.
        Default: 127
        Data disk size in GB.
      • disks Array of objects. Optional.
        Specifies an array of objects that indicate how to create data disks for the VM. Data disks are specified by the following object:
        • caching
          String. Required.
          Valid values: ReadOnly | ReadWrite | None
          Specifies cache settings for the data disk. ReadOnly sets write through caching, ReadWrite sets write back caching, and None sets no caching.
        • diskSizeGB
          Integer. Required.
          Default: 127 Data disk size in GB.
        • createOption
          String. Required.
          Valid values: attach | fromImage
          Specifies how data disks specified in the images array are created. fromImage specifies that compliant virtual disk images stored in Azure blob storage are used to create and attach data disks. attach specifies that existing managed disk images will be attached.
        • images
          Array of strings. At least one string required.
          A list of fully qualified paths to existing data disks. If createOption is set to fromImage, this is a one-dimensional array containing a list of fully-qualified paths to compliant disk images stored in Azure blob storage, and the number of array elements must match the count of data disks specified . If createOption is set to attach, this is a two-dimension array, with the number of first-dimension elements matching the vmCount and the number of second-dimension elements matching the count of data disks. The string values in the array must be fully-qualified paths to disk resources stored in Azure.
    • availabilitySet
      Object. Optional.
      Specifies configuration settings for the availability set where the VMs will be included. The configuration settings are specified using the following object:
      • name
        String. Required.
        The name of the availability set.
      • platformFaultDomainCount
        Integer between 1 and 3. Optional. Default: 3
        Specifies the number of fault domains for the availability set.
      • platformUpdateDomainCount
        Integer between 1 and 20. Optional.
        Default: 5
        Specifies the number of update domains for the availability set.
    • diagnosticStorageAccounts
      Object. Optional.
      Specifies configuration settings for the diagnostic storage accounts used by the VMs. Configuration settings are specified using the following object:
      • count
        Integer. Optional.
        Default: 1
        Number of diagnostic storage accounts to create.
      • nameSuffix
        String. Optional.
        Default: diag
        Specifies a string value to append to each diagnostic storage account name.
      • skuType
        String. Optional. Default: Standard_LRS Specifies the SKU name of the storage account type.
      • supportsHttpsTrafficOnly
        Boolean. Optional.
        Default: false
        Specifies that the diagnostic storage account can be accessed with the HTTPS protocol only.
      • encryptBlobStorage
        Boolean. Optional.
        Default: false
        Specifies that the storage account service must encrypt diagnostic data when saving to blob storage.
      • encryptFileStorage
        Boolean. Optional.
        Default: false
        Specifies that the storage account service must encrypt diagnostic data as it is stored to file storage.
      • keyVaultProperties
        Object. Required if encryptBlobStorage or encryptFileStorage set to true.
        Specifies configuration settings for the KeyVault service used to store the encryption keys for blob or file storage. KeyVault settings are specified using the following object:
        • keyName
          String. Required.
          The name of the key stored in KeyVault.
        • keyVersion
          String. Required.
          The version of the key stored in KeyVault.
      • keyVaultUri
        String. Required.
        The fully-qualified URI endpoint of the KeyVault service where the key is stored.
      • accounts
        Array of strings. Optional.
        List of resource names of existing storage accounts to use for diagnostic storage.
    • storageAccounts
      Object. Optional.
      Specifies configuration settings for the storage accounts used by the VMs. Configuration settings specified using the following object:
      • count
        Integer. Optional.
        Default: 1
        Number of storage accounts to create.
      • managed
        Boolean. Optional.
        Default: true
        Specifies that the storage account is managed.
      • nameSuffix
        String. Optional.
        Default: st
        Specifies a string value to append to each storage account name.
      • skuType
        String. Optional.
        Default: Premium_LRS
        Specifies the SKU name of the storage account type.
      • supportsHttpsTrafficOnly
        Boolean. Optional.
        Default: false
        Specifies that the storage account can be accessed using the HTTPS protocol only.
      • encryptBlobStorage
        Boolean. Optional.
        Default: false
        Specifies that the storage account service must encrypt data when saving to blob storage.
      • encryptFileStorage
        Boolean. Optional.
        Default: false
        Specifies that the storage account service must encrypt data when stored to file storage.
      • keyVaultProperties
        Object. Required if encryptBlobStorage or encryptFileStorage set to true.
        Specifies configuration settings for the KeyVault service used to store the encryption keys for blob or file storage. KeyVault settings are specified using the following object:
        • keyName
          String. Required.
          The name of the key stored in KeyVault.
        • keyVersion
          String. Required.
          The version of the key stored in KeyVault.
        • keyVaultUri
          String. Required.
          The fully-qualified URI endpoint of the KeyVault service where the key is stored.
      • accounts
        Array of strings. Optional.
        List of fully-qualified resource names of existing storage accounts to use.
  • scaleSetSettings
    Object. Optional.
    Specifies configuration information for a scale set using the following object:
    • resourceGroupName
      String. Optional.
      Specifies the name of the resource group where the scale set is deployed. Only used if a resource group is not specified with the -g or --resource-group option using the Template Building Block command line.
    • subscriptionId
      String. Optional.
      Specifies the ID of the Azure subscription where the resource group indicated above is deployed. Only used if a subscription ID is not specified with the -s or --subscription-id option using the Template Building Block command line.
    • location
      String. Optional.
      Specifies the Azure region the scale set is deployed to.
    • upgradePolicy
      String. Required.
      Valid values: Automatic | Manual
      Set to Automatic for automatic upgrade of VMs in the scale set. Set to Manual if upgrade of VMs in the scale set will be performed manually.
    • overprovision
      Boolean. Required.
      Set to true to overprovision the number of VMs in the scale set.
    • singlePlacementGroup
      Boolean. Required.
      Set to false to allow VMs to span multiple placement groups. Note that this property must be set to false if more than 100 VMs are provisioned in the scale set.
  • loadBalancerSettings
    Specifies configuration information for a load balancer.
  • applicationGatewaySettings
    Specifies configuration information for an application gateway.
  • tags
    Object. Optional.
    List of "name": "value" pairs that specify metadata associated with each VM.
Clone this wiki locally
You can’t perform that action at this time.