To create a snapshot of a Azure managed disk, you make a POST request with the block device ID of the managed disk. Using the snapshot ID created, you can list a snapshot or delete a snapshot of a managed disk.
Prerequisites
- Verify that all general prerequisites and prerequisites for the Automation Assembler Infrastructure as a Service (IaaS) service have been satisfied. See Prerequisites for API Use Case Examples.
- Verify that you have an Azure managed disk and a block device ID. See Create a Block Device.
Procedure
Example: Create snapshots of a managed disk
With the block device ID, create multiple snapshots of a managed disk.
Note: If your organization uses an API service that is hosted outside of the United States, your URL variable must include a country abbreviation. See
Regional Endpoints for VMware Aria Automation APIs.
$ url='https://api.mgmt.cloud.vmware.com'
$ api_version='2021-07-15'
$ block_device_id='41d600c2-429e-4c90-98d4-638e77724101'
Create a snapshot of the managed disk.
$ curl -X POST \ $url/iaas/api/block-devices/$block_device_id/operations/snapshots?apiVersion=$api_version \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $access_token" \ -d '{ "name": "demo-snapshot-1" }' | jq "."
The response provides a selfLink to the request.
{ "progress": 0, "status": "INPROGRESS", "name": "Provisioning", "id": "66123d15-8e5a-42b0-a0b4-e9ed8e21180a", "selfLink": "/iaas/api/request-tracker/66123d15-8e5a-42b0-a0b4-e9ed8e21180a" }
Assign the selfLink ID variable.
$ selfLink_id='66123d15-8e5a-42b0-a0b4-e9ed8e21180a'
Track the progress of the request.
$ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/request-tracker/$selfLink_id?apiVersion=$api_version | jq "."
Create a second snapshot of the managed disk.
$ curl -X POST \ $url/iaas/api/block-devices/$block_device_id/operations/snapshots?apiVersion=$api_version \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $access_token" \ -d '{ "name": "demo-snapshot-2" }' | jq "."
List all the snapshots of the managed disk.
$ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/block-devices/$block_device_id/snapshots?apiVersion=$api_version | jq "."
Examine the response to see all snapshot IDs.
[ { "name": "demo-snapshot-1", "snapshotProperties": { "incremental": "false" }, "id": "38348991-00a1-48be-80d6-00d62afcd280", "createdAt": "2022-04-02", "updatedAt": "2022-04-02", "owner": "[email protected]", "organizationId": "1b6fd77b-f5d9-466b-88d3-97c0d9eb70c9", "orgId": "1b6fd77b-f5d9-466b-88d3-97c0d9eb70c9", "_links": { "self": { "href": "/iaas/api/block-devices/41d600c2-429e-4c90-98d4-638e77724101/snapshots/38348991-00a1-48be-80d6-00d62afcd280" } } }, { "name": "demo-snapshot-2", "snapshotProperties": { "incremental": "false" }, "id": "80407f78-7f90-4d9f-83f4-10d3a1e982ac", "createdAt": "2022-04-02", "updatedAt": "2022-04-02", "owner": "[email protected]", "organizationId": "1b6fd77b-f5d9-466b-88d3-97c0d9eb70c9", "orgId": "1b6fd77b-f5d9-466b-88d3-97c0d9eb70c9", "_links": { "self": { "href": "/iaas/api/block-devices/41d600c2-429e-4c90-98d4-638e77724101/snapshots/80407f78-7f90-4d9f-83f4-10d3a1e982ac" } } } ]
Assign a snapshot ID variable.
$ snapshot_id='80407f78-7f90-4d9f-83f4-10d3a1e982ac'
List information about the snapshot.
$ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/block-devices/$block_device_id/snapshots/$snapshot_id?apiVersion=$api_version | jq "."
The response shows information about the single snapshot.
{ "name": "demo-snapshot-2", "snapshotProperties": { "incremental": "false" }, "id": "80407f78-7f90-4d9f-83f4-10d3a1e982ac", "createdAt": "2022-04-02", "updatedAt": "2022-04-02", "owner": "[email protected]", "organizationId": "1b6fd77b-f5d9-466b-88d3-97c0d9eb70c9", "orgId": "1b6fd77b-f5d9-466b-88d3-97c0d9eb70c9", "_links": { "self": { "href": "/iaas/api/block-devices/41d600c2-429e-4c90-98d4-638e77724101/snapshots/80407f78-7f90-4d9f-83f4-10d3a1e982ac" } } }