Share via


Create VM Image

 

The Create VM Image operation creates a VM Image in the image repository that is associated with the specified subscription using a specified set of virtual hard disks.

Request

The Create VM Image request may be specified as follows. Replace <subscription-id> with the subscription ID.

Method

Request URI

POST

https://management.core.windows.net/<subscription-id>/services/vmimages

URI Parameters

None.

Request Headers

The following table describes the request headers.

Request Header

Description

x-ms-version

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

Request Body

The format of the request body is as follows:

<VMImage xmlns="https://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <Name>name-of-image</Name>
  <Label>identifier-of-image</Label>
  <Description>description-of-image</Description>
  <OSDiskConfiguration>
    <HostCaching>caching-mode-of-disk</HostCaching>
    <OSState>state-of-disk</OSState>
    <OS>operating-system-of-image</OS>
    <MediaLink>path-to-vhd</MediaLink>
  </OSDiskConfiguration>
  <DataDiskConfigurations>
    <DataDiskConfiguration>
      <HostCaching>caching-mode-of-disk</HostCaching>
      <Lun>logical-unit-number</Lun>
      <MediaLink>path-to-vhd</MediaLink>
      <LogicalDiskSizeInGB>size-of-disk</LogicalDiskSizeInGB>
    </DataDiskConfigurations>
  </DataDiskConfiguration>    
  <Language>language-of-image</Language>
  <ImageFamily>image-family</ImageFamily>
  <RecommendedVMSize>size-of-virtual-machine</RecommendedVMSize>
  <Eula>image-eula</Eula>
  <IconUri>uri-of-icon</IconUri>
  <SmallIconUri>uri-of-icon</SmallIconUri>
  <PrivacyUri>uri-of-privacy-policy</PrivacyUri>
  <PublishedDate>published-date</PublishedDate>
  <ShowInGui>indicator-of-availability</ShowInGui>
</VMImage>

The following table describes the elements of the request body.

Element Name

Description

Name

Required. Specifies the name of the image.

Label

Required. Specifies an identifier for the image.

Description

Optional. Specifies the description of the image.

OSDiskConfiguration

Required. Specifies configuration information for the operating system disk that is associated with the image.

DataDiskConfigurations

Optional. Specifies configuration information for the data disks that are associated with the image. A VM Image might not have data disks associated with it.

Language

Optional. Specifies the language of the image.

ImageFamily

Optional. Specifies a value that can be used to group VM Images.

RecommendedVMSize

Optional. Specifies the size to use for the Virtual Machine that is created from the VM Image.

Eula

Optional. Specifies the End User License Agreement that is associated with the image. The value for this element is a string, but it is recommended that the value be a URL that points to a EULA.

IconUri

Optional. Specifies the URI to the icon that is displayed for the image in the Management Portal.

SmallIconUri

Optional. Specifies the URI to the small icon that is displayed for the image in the Management Portal.

PrivacyUri

Optional. Specifies the URI that points to a document that contains the privacy policy related to the image.

PublishedDate

Optional. Specifies the date when the image was added to the image repository.

ShowInGui

Optional. Indicates whether the VM Images should be listed in the portal.

OSDiskConfiguration

Specifies configuration information for the operating system disk that is associated with the image.

Element Name

Description

HostCaching

Optional. Specifies the caching behavior of the operating system disk.

Possible values are:

  • None

  • ReadOnly

  • ReadWrite

OSState

Required. Specifies the state of the operating system in the image.

Possible values are:

  • Generalized

  • Specialized

A Virtual Machine that is fully configured and running contains a Specialized operating system. A Virtual Machine on which the Sysprep command has been run with the generalize option contains a Generalized operating system.

OS

Required. Specifies the operating system type of the image.

MediaLink

Required. Specifies the location of the blob in Windows Azure storage. The blob location belongs to a storage account in the subscription specified by the <subscription-id> value in the operation call.

DataDiskConfigurations

Specifies configuration information for the data disks that are associated with the image.

Element Name

Description

HostCaching

Optional. Specifies the caching behavior of the data disk.

Possible values are:

  • None

  • ReadOnly

  • ReadWrite

Lun

Optional. Logical Unit Number (LUN) for the data disk. LUNs must not conflict with other Data Disks in the VM Image.

If this parameter is specified you must also specify the Name for the DataDiskConfiguration you want to change.

Values must be in the range 0-31.

MediaLink

Required. Specifies the location of the blob in Windows Azure storage. The blob location belongs to a storage account in the subscription specified by the <subscription-id> value in the operation call.

LogicalSizeInGB

Required. Specifies the size, in GB, of the data disk.

Response

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

Status Code

This is an asynchronous operation that always returns a status of 202 (Accepted). Use Get Operation Status to get the status of the operation as the image is being created. A successful operation returns status code 201 (Created).

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.