Capture VM Image
The Capture VM Image operation creates a copy of the operating system virtual hard disk (VHD) and all of the data VHDs that are associated with the Virtual Machine, saves the VHD copies in the same storage location as the original VHDs, and registers the copies as a VM Image in the image repository that is associated with the specified subscription.
Request
The Capture VM Image request may be specified as follows. Replace <subscription-id> with the subscription ID, <cloudservice-name> with the name of the cloud service, <deployment-name> with the name of the deployment, and <role-name> with the name of the Virtual Machine.
Method |
Request URI |
---|---|
POST |
https://management.core.windows.net/<subscription-id>/services/hostedservices/<service-name>/deployments/<deployment-name>/roleinstances/<role-name>/Operations |
You must make sure that the request that is made to the management service is secure.
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-02-01 or higher. |
Request Body
The following example shows the format of the request body:
<CaptureRoleAsVMImageOperation xmlns="https://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<OperationType>CaptureRoleAsVMImageOperation</OperationType>
<OSState>state-of-operating-system</OSState>
<VMImageName>name-of-image</VMImageName>
<VMImageLabel>label-of-image</VMImageLabel>
<Description>description-of-image</Description>
<Language>language-of-image</Language>
<ImageFamily>image-family</ImageFamily>
<RecommendedVMSize>size-of-virtual-machine</RecommendedVMSize>
</CaptureRoleAsVMImageOperation>
The following table describes the elements of the request body.
Element name |
Description |
---|---|
OperationType |
Required. Must be set to CaptureRoleAsVMImageOperation. |
OSState |
Required. Specifies the state of the operating system in the image. Possible values are:
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. If you capture an image from a generalized Virtual Machine, the machine is deleted after the image is captured. It is recommended that all Virtual Machines are shut down before capturing an image. |
VMImageName |
Required. Specifies the name of the VM Image. |
VMImageLabel |
Required. Specifies the label of the VM Image. |
Description |
Optional. Specifies the description of the VM Image. The Description element is only available using version 2014-05-01 or higher. |
Language |
Optional. Specifies the language of the VM Image. The Language element is only available using version 2014-05-01 or higher. |
ImageFamily |
Optional. Specifies a value that can be used to group VM Images. The ImageFamily element is only available using version 2014-05-01 or higher. |
RecommendedVMSize |
Optional. Specifies the size to use for the Virtual Machine that is created from the VM Image. The RecommendedVMSize element is only available using version 2014-05-01 or higher. |
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 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.