Add Role

 

The Add Role operation adds a Virtual Machine to a deployment of Virtual Machines. Before you run this operation, you must have an existing cloud service and deployment in Microsoft Azure.

Request

The Add Role request may be specified as follows. Replace <subscription-id> with the subscription ID, <cloudservice-name> with the name of the cloud service, and <deployment-name> with the name of the deployment.

Method

Request URI

POST

https://management.core.windows.net/<subscription-id>/services/hostedservices/<cloudservice-name>/deployments/<deployment-name>/roles

URI Parameters

None.

Request Headers

The following table describes the request headers.

Request Header

Description

Content-Type

Required. Set this header to application/xml.

x-ms-version

Required. Specifies the version of the operation to use for this request. This header should be set to 2012-03-01 or higher.

Request Body

The format of the request body is as follows:

<PersistentVMRole xmlns="https://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <RoleName>name-of-the-virtual-machine</RoleName>
  <RoleType>PersistentVMRole</RoleType>
  <LicenseType>type-of-license</LicenseType>
  <ConfigurationSets>
    <ConfigurationSet i:type="WindowsProvisioningConfigurationSet">
      <ConfigurationSetType>WindowsProvisioningConfiguration</ConfigurationType> 
      <ComputerName>name-of-computer</ComputerName>
      <AdminPassword>administrator-password</AdminPassword> 
      <EnableAutomaticUpdates>enable-updates</EnableAutomaticUpdates>  
      <TimeZone>time-zone</TimeZone>
      <DomainJoin>
        <Credentials>
          <Domain>domain-to-join</Domain>
          <Username>user-name-in-the-domain</Username>
          <Password>password-for-the-user-name</Password>
        </Credentials>
        <JoinDomain>domain-to-join</JoinDomain>
        <MachineObjectOU>distinguished-name-of-the-ou</MachineObjectOU>
      </DomainJoin>
      <StoredCertificateSettings>
        <CertificateSetting>
          <StoreLocation>LocalMachine</StoreLocation>
          <StoreName>name-of-store-on-the-machine</StoreName>
          <Thumbprint>certificate-thumbprint</Thumbprint>
        </CertificateSetting>
      </StoredCertificateSettings>
      <WinRM>
        <Listeners>
          <Listener>
            <Protocol>listener-protocol</Protocol>
          </Listener>
          <Listener>
            <CertificateThumbprint>certificate-thumbprint</CertificateThumbprint>
            <Protocol>listener-protocol</Protocol>
          </Listener>
        </Listeners>
      </WinRM>
      <AdminUsername>name-of-administrator-account</AdminUsername>
      <CustomData>base-64-encoded-data</CustomData>
      <AdditionalUnattendContent>
        <Passes>
          <UnattendPass>
            <PassName>name-of-pass</PassName>
            <Components>
              <UnattendComponent>
                <ComponentName>name-of-component</ComponentName>
                <ComponentSettings>
                  <ComponentSetting>
                    <SettingName>name-of-setting</SettingName>
                    <Content>base-64-encoded-XML-content</Content>
                  </ComponentSetting>
                </ComponentSettings>
              </UnattendComponent>
            </Components>
          </UnattendPass>
        </Passes>
      </AdditionalUnattendedContent>
    </ConfigurationSet>
    <ConfigurationSet i:type="LinuxProvisioningConfigurationSet">
      <ConfigurationSetType>LinuxProvisioningConfiguration</ConfigurationType>
      <HostName>host-name-for-the-virtual-machine</HostName>
      <UserName>new-user-name</UserName> 
      <UserPassword>password-for-the-new-user</UserPassword> 
      <DisableSshPasswordAuthentication>password-authentication</DisableSshPasswordAuthentication>           
      <SSH>
        <PublicKeys>
          <PublicKey>
            <Fingerprint>certificate-fingerprint</Fingerprint>
            <Path>SSH-public-key-storage-location</Path>     
          </PublicKey>
        </PublicKeys>
        <KeyPairs>
          <KeyPair>
            <Fingerprint>certificate-fingerprint</Fingerprint>
            <Path>SSH-public-key-storage-location</Path>
          </KeyPair>
        </KeyPairs>
      </SSH>
      <CustomData>base-64-encoded-data</CustomData>
    </ConfigurationSet>
    <ConfigurationSet>
      <ConfigurationSetType>NetworkConfiguration</ConfigurationSetType>          
      <InputEndpoints>
        <InputEndpoint>
          <LoadBalancedEndpointSetName>name-of-load-balanced-set</LoadBalancedEndpointSetName>
          <LocalPort>local-port-number</LocalPort>
          <Name>name-of-endpoint</Name>
          <Port>external-port-number</Port>
          <LoadBalancerProbe>
            <Path>path-of-probe</Path>
            <Port>port-assigned-to-probe</Port>
            <Protocol>probe-protocol</Protocol>
            <IntervalInSeconds>interval-of-probe</IntervalInSeconds>
            <TimeoutInSeconds>timeout-for-probe</TimeoutInSeconds>
          </LoadBalancerProbe>
          <Protocol>endpoint-protocol</Protocol>
          <EnableDirectServerReturn>enable-direct-server-return</EnableDirectServerReturn>
          <EndpointACL>
            <Rules>
              <Rule>
                <Order>priority-of-the-rule</Order>
                <Action>permit-rule</Action>
                <RemoteSubnet>subnet-of-the-rule</RemoteSubnet>
                <Description>description-of-the-rule</Description>
              </Rule>
            </Rules>
          </EndpointACL>
          <LoadBalancerName>name-of-internal-loadbalancer</LoadBalancerName>
          <IdleTimeoutInMinutes>timeout-for-tcp-idle-connection</IdleTimeoutInMinutes>  
        </InputEndpoint>
      </InputEndpoints>
      <SubnetNames>
        <SubnetName>name-of-subnet</SubnetName>
      </SubnetNames>
      <StaticVirtualNetworkIPAddress>ip-address</StaticVirtualNetworkIPAddress>
      <NetworkSecurityGroup>network-security-group</NetworkSecurityGroup>
      <PublicIPs>
        <PublicIP>
          <Name>name-of-public-ip</Name>
          <IdleTimeoutInMinutes>timeout-for-tcp-idle-connection</IdleTimeoutInMinutes>
          <DomainNameLabel>domain-label</DomainNameLabel>
        <PublicIP>
      <PublicIPs>
      <NetworkInterfaces>
        <NetworkInterface>
          <Name>interface-name</Name>
          <MacAddress>mac-address</MacAddress>
          <IPConfigurations>
            <IPConfiguration>
              <SubnetName>subnet-name</SubnetName>
              <Address>ip-address</Address>
            </IPConfiguration>
          <IPConfigurations>
        </NetworkInterface>
      </NetworkInterfaces>
    </ConfigurationSet>
  </ConfigurationSets>
  <ResourceExtensionReferences>
    <ResourceExtensionReference>
      <ReferenceName>name-of-reference</ReferenceName>
      <Publisher>name-of-publisher</Publisher>
      <Name>name-of-extension</Name>
      <Version>version-of-extension</Version>
      <ResourceExtensionParameterValues>
        <ResourceExtensionParameterValue>
          <Key>name-of-parameter-key</Key>
          <Value>parameter-value</Value>
          <Type>type-of-parameter</Type>
        </ResourceExtensionParameterValue>
      </ResourceExtensionParameterValues>
      <State>state-of-resource</State>
      <Certificates>
        <Certificate>
          <Thumbprint>certificate-thumbprint</Thumbprint>
          <ThumbprintAlgorithm>certificate-algorithm</ThumbprintAlgorithm>
        </Certificate>
      </Certificates>
    </ResourceExtensionReference>
  </ResourceExtensionReferences>
  <VMImageName>name-of-vm-image</VMImageName>
  <MediaLocation>path-to-vhd</MediaLocation>
  <AvailabilitySetName>name-of-availability-set</AvailabilitySetName>
  <DataVirtualHardDisks>
    <DataVirtualHardDisk>
      <HostCaching>caching-mode</HostCaching> 
      <DiskLabel>label-of-data-disk</DiskLabel>            
      <DiskName>name-of-disk</DiskName>
      <Lun>logical-unit-number</Lun>
      <LogicalDiskSizeInGB>size-in-gb-of-data-disk</LogicalDiskSizeInGB>            
      <MediaLink>path-to-vhd</MediaLink>
    </DataVirtualHardDisk>
  </DataVirtualHardDisks>
  <OSVirtualHardDisk>
    <HostCaching>caching-mode</HostCaching>    
    <DiskLabel>label-of-operating-system-disk</DiskLabel>
    <DiskName>name-of-disk</DiskName>                    
    <MediaLink>path-to-vhd</MediaLink>
    <SourceImageName>name-of-source-image</SourceImageName>
    <OS>operating-system-of-image</OS>
    <RemoteSourceImageLink>path-to-source-image</RemoteSourceImageLink>
    <ResizedSizeInGB>resized-size</ResizedSizeInGB>
  </OSVirtualHardDisk>      
  <RoleSize>size-of-virtual-machine</RoleSize>
  <ProvisionGuestAgent>install-an-agent</ProvisionGuestAgent>
  <VMImageInput>
    <OSDiskConfiguration>
      <ResizedSizeInGB>resized-size</ResizedSizeInGB>
    </OSDiskConfiguration>
    <DataDiskConfigurations>
      <DataDiskConfiguration>
        <Name>data-disk-name</Name>
        <ResizedSizeInGB>resized-size</ResizedSizeInGB>
      </DataDiskConfiguration>
    </DataDiskConfigurations>
  </VMImageInput>
</PersistentVMRole>

The following table describes the elements of the request body.

Element name

Description

RoleName

Required. Specifies the name for the Virtual Machine.

RoleType

Required. Specifies the type of role to use. For Virtual Machines, this must be PersistentVMRole.

LicenseType

Optional. Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system.

Possible values are:

  • Windows_Client

  • Windows_Server

ConfigurationSets

Optional. Contains a collection of configuration sets that define system and application settings.

ResourceExtensionReferences

Optional. Contains a collection of resource extensions that are to be installed on the Virtual Machine. This element is used if ProvisionGuestAgent is set to true.

The ResourceExtensionReferences element is only available using version 2013-11-01 or higher.

VMImageName

Optional. Specifies the name of the VM Image that is to be used to create the Virtual Machine. If this element is used, the ConfigurationSets element is not used.

The VMImageName element is only available using version 2014-02-01 or higher.

MediaLocation

Required if the Virtual Machine is being created from a published VM Image. Specifies the location of the VHD file that is created when VMImageName specifies a published VM Image.

The MediaLocation element is only available using version 2014-05-01 or higher.

AvailabilitySetName

Optional. Specifies the name of a collection of Virtual Machines. Virtual Machines specified in the same availability set are allocated to different nodes to maximize availability.

DataVirtualHardDisks

Optional. Contains the parameters that are used to add a data disk to a Virtual Machine. If you are creating a Virtual Machine by using a VM Image, this element is not used.

OSVirtualHardDisk

Optional. Contains the parameters that are used to create the operating system disk for a Virtual Machine. If you are creating a Virtual Machine by using a VM Image, this element is not used.

RoleSize

Optional. Specifies the size of the Virtual Machine. The default size is Small.

ProvisionGuestAgent

Optional. Indicates whether the VM Agent is installed on the Virtual Machine. To run a resource extension in a Virtual Machine, this service must be installed.

Possible values are:

  • true

  • false

VMImageInput

Optional. Specifies a new size for the disks in a VM Image.

The VMImageInput element is only available using version 2014-10-01 or higher.

ConfigurationSets

Contains a collection of configuration sets that specify system and application configuration settings.

Element name

Description

ConfigurationSet

Required. Specifies the configuration elements of the Virtual Machine. The type attribute is required to prevent the administrator password from being written to the operation history file.

ConfigurationSetType

Required. To create a Virtual Machine, you must specify one of the following configuration sets:

  • WindowsProvisioningConfiguration

  • LinuxProvisioningConfiguration

Optional. You can optionally specify a NetworkConfiguration set that contains the metadata required to create the virtual network configuration for a Virtual Machine.

ComputerName

Optional in WindowsProvisioningConfiguration. Specifies the computer name for the Virtual Machine. If you do not specify a computer name, one is assigned that is a combination of the deployment name, role name, and identifying number. Computer names must be 1 to 15 characters long.

AdminPassword

Optional in WindowsProvisioningConfiguration. Specifies the password to use for an administrator account on the Virtual Machine that is being created. If you are creating a Virtual Machine using an image, you must specify a name of an administrator account to be created on the machine using the AdminUsername element. You must use the AdminPassword element to specify the password of the administrator account that is being created. If you are creating a Virtual Machine using an existing specialized disk, this element is not used because the account should already exist on the disk.

EnableAutomaticUpdates

Optional in WindowsProvisioningConfiguration. Specifies whether automatic updates are enabled for the Virtual Machine. Updates occur at a random time between 3:00 AM and 5:00 AM.

Possible values are:

  • true

  • false

The default value is true.

TimeZone

Optional in WindowsProvisioningConfiguration. Specifies the time zone for the Virtual Machine.

For a complete list of supported time zone entries, you can:

  • Refer to the values listed in the registry entry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones.

  • You can use the tzutil command-line tool to list the valid time.

DomainJoin

Optional in WindowsProvisioningConfiguration. Contains properties that define a domain to which the Virtual Machine will be joined.

StoredCertificateSettings

Optional in WindowsProvisioningConfiguration. Contains a list of service certificates with which to provision to the new Virtual Machine.

WinRM

Optional in WindowsProvisioningConfiguration. Contains configuration settings for the Windows Remote Management service on the Virtual Machine. This enables remote Windows PowerShell.

The WinRM element is only supported in version 2013-03-01 and higher.

AdminUsername

Optional in WindowsProvisioningConfiguration. Specifies the name of the administrator account that is created to access the Virtual Machine. If you are creating a Virtual Machine using an image, you must specify a name of an administrator account to be created by using this element. You must use the AdminPassword element to specify the password of the administrator account that is being created. If you are creating a Virtual Machine using an existing specialized disk, this element is not used because the account should already exist on the disk.

CustomData

Optional in WindowsProvisioningConfiguration. Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. The file is saved to %SYSTEMDRIVE%\AzureData\CustomData.bin. If the file exists, it is overwritten. The security on directory is set to System:Full Control and Administrators:Full Control.

The CustomData element is only available using version 2013-10-01 or higher.

AdditionalUnattendContent

Optional. Specifies additional base-64 encoded XML formatted information that can be included in the Unattend.xml file, which is used by Windows Setup.

The AdditionalUnattendContent element is only available using version 2014-04-01 or higher.

HostName

Required in LinuxProvisioningConfiguration. Specifies the host name for the Virtual Machine. Host names must be 1 to 64 characters long.

UserName

Required in LinuxProvisioningConfiguration. Specifies the name of a user account to be created in the sudoer group of the Virtual Machine. User account names must be 1 to 32 characters long.

UserPassword

Required in LinuxProvisioningConfiguration. Specifies the password for the user account. Passwords must be 6 to 72 characters long.

DisableSshPasswordAuthentication

Optional in LinuxProvisioningConfiguration. Specifies whether SSH password authentication is disabled. By default this value is set to true.

Possible values are:

  • true

  • false

The default value is true.

SSH

Optional in LinuxProvisioningConfiguration. Specifies the SSH public keys and key pairs to use with the Virtual Machine.

CustomData

Optional in LinuxProvisioningConfiguration. Specifies a base-64 encoded string of custom data. The base-64 encoded string is located in the ovf-env.xml file on the ISO of the Virtual Machine. The file is copied to /var/lib/waagent/ovf-env.xml by the Azure Linux Agent. The agent will also place the base-64 encoded data in /var/lib/waagent/CustomData during provisioning. The maximum length of the binary array is 65535 bytes.

The CustomData element is only available using version 2013-10-01 or higher.

InputEndpoints

Optional in NetworkConfiguration. Contains a collection of external endpoints for the Virtual Machine.

SubnetNames

Optional in NetworkConfiguration. Contains a list of subnets to which the Virtual Machine will belong.

StaticVirtualNetworkIPAddress

Optional. Specifies the internal IP address for the Virtual Machine in a Virtual Network. If you specify this element, you must also specify the SubnetNames element with only one subnet defined. The IP address specified in this element must belong to the subnet that is defined in SubnetNames and it should not be the first four IP addresses or the last IP address in the subnet. Deploying web roles or worker roles into a subnet that has Virtual Machines with StaticVirtualNetworkIPAddress defined is not supported.

The StaticVirtualNetworkIPAddress element is only available using version 2013-11-01 or higher.

NetworkSecurityGroup

Optional. Represents the name of the Network Security Group that will be associated with the Virtual Machine. Network Security Group must exist in the context of subscription and be created in same region to which the virtual machine will be deployed.

The NetworkSecurityGroup element is only available using version 2014-10-01 or higher.

PublicIPs

Optional. Contains a public IP address that can be used in addition to default virtual IP address for the Virtual Machine.

The PublicIPs element is only available using version 2014-05-01 or higher.

NetworkInterfaces

Optional, A set of secondary network interfaces. The number of secondary network interfaces allowed depends on the size of the virtual machine.The NetworkInterfaces element is only available using version 2014-08-01 or higher.

DomainJoin

Contains properties that define a domain to which the Virtual Machine will be joined.

Element name

Description

Credentials

Optional. Specifies the credentials to use to join the Virtual Machine to the domain.

JoinDomain

Optional. Specifies the domain to join.

MachineObjectOU

Optional. Specifies the Lightweight Directory Access Protocol (LDAP) X 500-distinguished name of the organizational unit (OU) in which the computer account is created. This account is in Active Directory on a domain controller in the domain to which the computer is being joined.

Example: OU=MyOu,OU=MyParentOu,DC=example.com,DC=MyCompany,DC=com

Credentials

Specifies the credentials to use to join the Virtual Machine to the domain.

Element name

Description

Domain

Optional. Specifies the name of the domain used to authenticate an account. The value is a fully qualified DNS domain. If the domains name is not specified, Username must specify the user principal name (UPN) format (user@fully-qualified-DNS-domain) or the fully-qualified-DNS-domain\username format.

Example: example.com

Username

Required. Specifies a user name in the domain that can be used to join the domain.

Password

Required. Specifies the password to use to join the domain.

StoredCertificateSettings

Contains a list of service certificates with which to provision to the new Virtual Machine. Stored certificate settings reference certificates that already exist in the cloud service. Before you configure the stored certificates for the Virtual Machine, you must call the Add Service Certificate operation or add the certificate by using the Management Portal.

Element name

Description

CertificateSetting

Required. Specifies the parameters for the certificate.

StoreLocation

Required. Specifies the certificate store location on the Virtual Machine.

The only supported value is LocalMachine.

StoreName

Required. Specifies the name of the certificate store from which the certificate is retrieved.

Example: My

Thumbprint

Required. Specifies the thumbprint of the certificate. The thumbprint must specify an existing service certificate.

WinRM

Contains configuration settings for the Windows Remote Management service on the Virtual Machine.

Element name

Description

Listeners

Required. Contains a collection of information for enabling remote Windows PowerShell.

Listener

Required. Specifies the protocol and certificate information for the listener.

Protocol

Specifies the protocol of listener.

Possible values are:

  • Http

  • Https

The value is case sensitive.

CertificateThumbprint

Optional. Specifies the certificate thumbprint for the secure connection. If this value is not specified, a self-signed certificate is generated and used for the Virtual Machine.

AdditionalUnattendContent

Specifies additional base-64 encoded XML formatted information that can be included in the Unattend.xml file, which is used by Windows Setup.

Element name

Description

PassName

Required. Specifies the name of the pass that the content applies to. The only allowable value is oobeSystem.

ComponentName

Required. Specifies the name of the component to configure with the added content. The only allowable value is Microsoft-Windows-Shell-Setup.

SettingName

Required. Specifies the name of the setting to which the content applies.

Possible values are:

  • FirstLogonCommands

  • AutoLogon

Content

Required. Specifies the base-64 encoded XML formatted content that is added to the unattend.xml file for the specified path and component. The XML must be less that 4 KB and must include the root element for the setting or feature that is being inserted.

SSH

Specifies the SSH public keys and key pairs to use with the Virtual Machine.

Element name

Description

PublicKeys

Optional. Specifies the collection of SSH public keys.

PublicKey

Required. Specifies the public key.

FingerPrint

Required. Specifies the SHA1 fingerprint of an X509 certificate associated with the cloud service and includes the SSH public key.

Path

Required. Specifies the full path of a file, on the Virtual Machine, where the SSH public key is stored. If the file already exists, the specified key is appended to the file.

Example: /home/user/.ssh/authorized_keys

KeyPairs

Required. Specifies a collection of SSH key pairs.

KeyPair

Required. Specifies an SSH key pair to be installed on the Virtual Machine.

FingerPrint

Required. Specifies the SHA1 fingerprint of an X509 certificate that is associated with the cloud service and includes the SSH keypair.

Path

Required. Specifies the full path of a file, on the virtual machine, which stores the SSH private key. The file is overwritten when multiple keys are written to it. The SSH public key is stored in the same directory and has the same name as the private key file with .pub suffix.

Example: /home/user/.ssh/id_rsa

InputEndpoints

Contains a collection of external endpoints for the Virtual Machine.

Element name

Description

InputEndpoint

Required. Specifies the properties that define an external endpoint for the Virtual Machine.

LoadBalancedEndpointSetName

Optional. Specifies a name for a set of load-balanced endpoints. Specifying this element for an endpoint adds it to the set.

Do not set this property if you are adding the endpoint to connect to the Virtual Machine by using the Remote Desktop. The endpoint name must be unique within the scope of the Virtual Machine.

LocalPort

Required. Specifies the internal port on which the Virtual Machine is listening.

Name

Required. Specifies the name of the external endpoint.

Port

Required. Specifies the external port to use for the endpoint.

LoadBalancerProbe

Optional. Contains properties that define the endpoint settings that the load balancer uses to monitor the availability of the Virtual Machine before forwarding traffic to it.

Protocol

Required. Specifies the transport protocol for the endpoint.

Possible Values are:

  • TCP

  • UDP

The default value is false.

EnableDirectServerReturn

Optional. Specifies whether the endpoint uses Direct Server Return. The EnableDirectServerReturn element is not supported for RDP, SSH, or WinRM endpoints and it is not supported when the public port and local port of an endpoint are different. It is recommended that this element is only used when setting up Virtual Machines for SQL Server and AlwaysOn Availability Groups.

Possible values are:

  • true

  • false

The default value is false.

EndpointACL

Optional. Contains a collection of rules that control the network traffic to the endpoint.

The EndpointACL element is only available using version 2013-06-01 or higher.

LoadBalancerName

Optional. Specifies the name of the internal load balancer that is associated with this endpoint.

The LoadBalancerName element is only available using version 2014-05-01 or higher.

IdleTimeoutInMinutes

Optional. Specifies the timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the protocol is set to TCP.

The IdleTimeoutInMinutes element is only available using version 2014-06-01 or higher.

LoadBalancerProbe

Contains properties that define the endpoint settings that the load balancer uses to monitor the availability of the Virtual Machine before forwarding traffic to it.

Element name

Description

Path

Optional. Specifies the relative path to inspect to determine the availability status of the Virtual Machine. If Protocol is set to TCP, this value must be NULL.

Example: path

The probe will use https://example.com/path to perform the probe.

Port

Optional. Specifies the port to use to inspect the availability status of the Virtual Machine.

Protocol

Optional. Specifies the protocol to use to inspect the availability status of the virtual machine.

Possible values are:

  • HTTP

  • TCP

IntervalInSeconds

Optional. Specifies the interval for the load balancer probe in seconds. The minimum value is 5 seconds. The default is 15 seconds.

TimeoutInSeconds

Optional. Specifies the timeout for the load balancer probe in seconds. The minimum value is 11 seconds. The default is 31 seconds.

EndpointACL

Contains a collection of rules that control the inbound network traffic to the endpoint.

Element name

Description

Rules

Required. Specifies a collection of access control rules. A maximum of 50 rules are allowed.

Rule

Required. Specifies the definition of an access control rule.

Order

Required. Specifies the priority of the rule. The value can be between 0 and 65535. The order number must be unique for each rule in the collection. The lower the order number, the higher the priority of the rule.

Action

Required. Specifies whether traffic that matches the rule should be permitted or denied.

Possible values are:

  • permit

  • deny

RemoteSubnet

Required. Specifies the subnet for the rule. The subnet must be in IPV4 Classless Inter-Domain Routing (CIDR) notation, and must be a valid subnet.

Description

Optional. Specifies a description for the rule. The maximum length of the description is 256 characters.

PublicIPs

Contains a public IP address that can be used in addition to default virtual IP address for the Virtual Machine.

Element name

Description

PublicIP

Required. Specifies an additional IP public address that can be used to communicate with the Virtual Machine.

Name

Required. Specifies the name of the public IP address.

IdleTimeoutInMinutes

Optional. Specifies the timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the protocol is set to TCP.

The IdleTimeoutInMinutes element is only available using version 2014-06-01 or higher.

DomainNameLabel

Optional. Specifies the domain name label for the public IP.

The DomainNameLabel element is only available using version 2015-03-01 or higher.

NetworkInterfaces

Contains a set of secondary network interfaces.

Element name

Description

NetworkInterface

Required. Specifies a secondary network interface.

Name

Required, Specifies the name of the secondary network interface.

MacAddress

Required. Specifies the MAC address of the secondary network interface.

IPConfigurations

Required. Specifies a set of IP address configurations for a secondary network interface.

IPConfigurations

Specifies a set of IP address configurations for a secondary network interface.

Element name

Description

IPConfiguration

Required. Specifies an IP address configuration for a secondary network interface.

Currently only one IP address configuration is supported for a secondary network interface.

SubnetName

Required. Specifies the name of the virtual network subnet that this IP address configuration belongs.

Address

Required, Specifies the internal IP address configured for a secondary network interface.

SubnetNames

Contains a list of subnets to which the Virtual Machine will belong.

Element name

Description

SubnetName

Required. Specifies the name of a subnet to which the Virtual Machine belongs.

DataVirtualHardDisks

Contains the parameters that are used to add a data disk to a Virtual Machine.

Element name

Description

DataVirtualHardDisk

Required. Specifies the properties that are used to create a data disk.

HostCaching

Optional. Specifies the caching behavior of the data disk for read/write efficiency. Setting this property impacts the consistency of the disk.

Possible values are:

  • None

  • ReadOnly

  • ReadWrite

The default value is None.

DiskLabel

Optional. If the disk that is being added is already registered in the subscription, this element is ignored. If a new disk is being created, this element is used to provide a description of the disk. The value of this element is only obtained programmatically and does not appear in the Management Portal.

DiskName

Optional. If the disk that is being added is already registered in the subscription, this element is used to identify the disk to add. If a new disk and the associated VHD is being created by Azure, this element is not used and Azure assigns a unique name that is a combination of the deployment name, role name, and identifying number.

The name of the disk must contain only alphanumeric characters, underscores, periods, or dashes. The name must not be longer than 256 characters. The name must not end with period or dash.

Lun

Optional. Specifies the Logical Unit Number (LUN) for the data disk. If the disk is the first disk that is added, this element is optional and the default value of 0 is used. If more than one disk is being added, this element is required. Valid LUN values are 0 through 31.

LogicalDiskSizeInGB

Optional. Specifies the size, in GB, of an empty disk to be attached to the Virtual Machine. If the disk that is being added is already registered in the subscription, this element is ignored. If the disk and VHD is being created by Azure as it is added, this element defines the size of the new disk.

The number of disks that can be added to a Virtual Machine is limited by the size of the machine.

This element is used with the MediaLink element.

MediaLink

Optional. If the disk that is being added is already registered in the subscription or the VHD for the disk already exists in blob storage, this element is ignored. If a VHD file does not exist in blob storage, this element defines the location of the new VHD that is created when the new disk is added.

Example: http://example.blob.core.windows.net/disks/mydatadisk.vhd

SourceMediaLink

Optional. If the disk that is being added is already registered in the subscription or the VHD for the disk does not exist in blob storage, this element is ignored. If the VHD file exists in blob storage, this element defines the path to the VHD and a disk is registered from it and attached to the virtual machine.

OSVirtualHardDisk

Contains the parameters that are used to create the operating system disk for a Virtual Machine.

Element name

Description

HostCaching

Optional. Specifies the caching mode of the operating system disk. This setting impacts the consistency and performance of the disk.

Possible values are:

  • ReadOnly

  • ReadWrite

The default value is ReadWrite. Changing this value causes the Virtual Machine to reboot.

DiskLabel

Optional. Specifies the description of the disk.

DiskName

Required if an existing disk is being used to create a Virtual Machine. Specifies the name of a new or existing disk. For a new disk, if this element is not specified, a unique name is assigned that is a combination of the deployment name, role name, and identifying number.

The name of the disk must contain only alphanumeric characters, underscores, periods, or dashes. The name must not be longer than 256 characters. The name must not end with period or dash.

MediaLink

Required if the Virtual Machine is being created from a platform image. Specifies the location of the VHD file that is created when SourceImageName specifies a platform image. This element is not used if the Virtual Machine is being created using an existing disk.

Example: http://contoso.blob.core.windows.net/disks/mydisk.vhd

SourceImageName

Optional. Specifies the name of the image to use to create the Virtual Machine. You can specify a user image or a platform image. An image is always associated with a VHD, which is a .vhd file stored as a page blob in a storage account in Azure. If you specify a platform image, an associated VHD is created and you must use the MediaLink element to specify the location in storage where the VHD will be located.

OS

Required if RemoteSourceImageLink is used. Specifies the type of operating system that is installed in the image.

Possible values are:

  • Windows

  • Linux

RemoteSourceImageLink

Optional. Specifies a URI to the location where an OS image is stored that is used to create the Virtual Machine. An image is always associated with a VHD, which is a .vhd file stored as a page blob in a storage account in Windows Azure. If you specify the path to an image with this element, an associated VHD is created and you must use the MediaLink element to specify the location in storage where the VHD will be located. If this element is used, SourceImageName is not used.

The RemoteSourceImageLink element is only available using version 2014-05-01 or higher.

ResizedSizeInGB

When an OS Image or a RemoteSourceImage is used to create an OSVirtualHardDisk, this parameter can be used to resize the new OSVirtualHardDisk to a larger size. ResizedSizeInGB must be larger than the underlying OS Image’s LogicalSizeInGB. The ResizedSizeInGB element is only available using version 2014-10-01 or higher.

VMImageInput

Specifies a new size for the disks in a VM Image.

Element Name

Description

OSDiskConfiguration

Optional. Specifies the configuration of the operating system disk of the VM Image.

The OSDiskConfiguration element is only available using version 2014-10-01 or higher.

ResizedSizeInGB

Required. Specifies the new (larger) size of the operating system disk in the VM Image.

The ResizedSizeInGB element is only available using version 2014-10-01 or higher.

DataDiskConfigurations

Optional. Specifies the configuration of the data disks of the VM Image.

The DataDiskConfigurations element is only available using version 2014-10-01 or higher.

DataDiskConfigurations

Specifies the configuration of the data disks of the VM Image.

Element Name

Description

DataDiskConfiguration

Required. Specifies the configuration of the data disk.

The DataDiskConfiguration element is only available using version 2014-10-01 or higher.

Name

Required. Specifies the name of the data disk.

The Name element is only available using version 2014-10-01 or higher.

Example: MyVMImage1-datadisk-2-2014-02-21

ResizedSizeInGB

Required. Specifies the new (larger) size of the data disk.

The ResizedSizeInGB element is only available using version 2014-10-01 or higher.

ResourceExtensionReferences

Contains a collection of resource extensions that are to be installed on the Virtual Machine. A resource extension is a software component that is installed on the Virtual Machine. The VM Agent must be installed on the Virtual Machine to install resource extensions.

Element name

Description

ResourceExtensionReference

Required. Specifies the properties of a resource extension that should be installed on the Virtual Machine.

ReferenceName

Required. Specifies the reference name of the resource extension.

Publisher

Required. Specifies the name of the publisher who created the resource extension. You can use List Resource Extensions to find the publisher name of a resource extension.

Name

Required. Specifies the name of the resource extension. You can use List Resource Extensions to find the names of available resource extensions.

Version

Required. Specifies the version of the resource extension. You can set this value to * to use the latest version of the extension. If the extension has been recently added or updated, you must make sure that the value of ReplicationCompleted is set to true before you can use the version of the extension. You can use List Resource Extension Versions to determine the replication status and the available versions of the extension.

ResourceExtensionParameterValues

Optional. Contains a collection of parameters that are passed to the resource extension when it is installed.

State

Optional. Specifies the state of the resource extension. When a Virtual Machine is created, the only state that can be specified is enable, which is the default value if this element is not used.

Certificates

Optional. Contains a collection of certificates that are installed on the Virtual Machine and used by the extension. Before certificates can be included in this request, they must be added to the cloud service.

The Certificates element is only available using version 2014-06-01 or higher.

Certificates

Contains a collection of certificates that are installed on the Virtual Machine and used by the extension.

Element name

Description

Thumbprint

Required. Specifies the thumbprint of the certificate that is to be used by the extension.

ThumbprintAlgorithm

Required. Specifies the thumbprint algorithm. This value is always sha1.

ResourceExtensionParameterValues

Contains a collection of parameters that are passed to the resource extension when it is installed.

Element name

Description

ResourceExtensionParameterValue

Required. Specifies the key, value, and type of the parameter.

Key

Required. Specifies the key of the parameter.

Value

Required. Specifies the base-64 encoded value of the parameter. If the configuration of the extension is formatted in XML, this value is validated by using the public or private schema. The schema that is used depends on the value of Type.

If the configuration of the extension is formatted in JSON, this value must contain a valid JSON object. The public or private schemas cannot be used to validate the object. To use a JSON object, the version must be 2014-04-01 or higher.

Type

Required. Specifies the type for the resource extension.

Possible values are:

  • Public

  • Private

You can only specify one public parameter and one private parameter for a maximum of two parameters.

Dns

Contains a list of DNS servers to associate with the Virtual Machine.

Element name

Description

DnsServers

Required. Contains the parameters specifying the DNS servers to use for the Virtual Machine.

DnsServer

Required. Contains the Name and Address elements of the DNS server.

Name

Required. Specifies the name of the DNS server.

Address

Required. Specifies the IP address of the DNS server.

Response

The response includes an HTTP status code, a set of response headers, and a response body.

Status Code

A successful operation returns status code 202 (Accepted).

Response Headers

The response for this operation includes the following headers. The response may also include additional standard HTTP headers.

Response Header

Description

x-ms-request-id

A value that uniquely identifies a request made against the management service.

Response Body

None.

Remarks

Provisioned disks can only be added to provisioned VM sizes.