If you do not already have an Azure managed disk, create a block device to use for your snapshot. To create a block device, you make a POST request using the block device specification. The request body includes a project ID, disk capacity, persistence setting, and constraints from the Azure Storage Profile for 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 added a project and you have the project ID. See Create a Project to use in Automation Assembler.
- Know the capacity of the disk and the persistence of the disk that you are creating.
- Verify that you have created a storage profile for a managed disk and that you have the
defaultItemand the tags from the response. See Create a Microsoft Azure Storage Profile for a Managed Disk.
Procedure
Example: Create a Block Device
With constraints from an Azure Storage Profile for a managed disk, use the block device specification to deploy a managed disk for a project ID with a two GB capacity and persistence set to false.
$ url='https://appliance.domain.com'
$ api_version='2021-07-15'
$ project_id='f5357a28-df59-47e0-b983-8a562910d0be'
$ capacity_in_gb=2
$ persistent=false
Deploy the block device.
$ curl -X POST \
$url/iaas/api/block-devices?apiVersion=$api_version \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $access_token" \
-d '{
"projectId": "'$project_id'",
"name": "block-device-example",
"capacityInGB": "'$capacity_in_gb'",
"persistent" : "'$persistent'",
"constraints": [
{
"mandatory": "false",
"expression": "type:managed"
}
]
}' | jq "."
The response provides a selfLink to the request.
{
"progress": 0,
"status": "INPROGRESS",
"name": "Provisioning",
"id": "22bdaf20-ce48-4a9f-8c1f-f4e74263645f",
"selfLink": "/iaas/api/request-tracker/22bdaf20-ce48-4a9f-8c1f-f4e74263645f",
"deploymentId":"cf33c90e-6f6d-48ed-82dd-a6a9f0e6f700"
}
Assign the selfLink ID variable.
$ selfLink_id='22bdaf20-ce48-4a9f-8c1f-f4e74263645f'
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 "."
After the request completes successfully, the response provides the block device ID.
{
"progress": 100,
"message": "success",
"status": "FINISHED",
"resources": [
"/iaas/api/block-devices/41d600c2-429e-4c90-98d4-638e77724101"
],
"name": "Provisioning",
"id": "22bdaf20-ce48-4a9f-8c1f-f4e74263645f",
"selfLink": "/iaas/api/request-tracker/22bdaf20-ce48-4a9f-8c1f-f4e74263645f",
"deploymentId":"cf33c90e-6f6d-48ed-82dd-a6a9f0e6f700"
}
Assign the block device ID variable.
$ block_device_id='41d600c2-429e-4c90-98d4-638e77724101'