disks
Creates, updates, deletes, gets or lists a disks resource.
Overview
| Name | disks |
| Type | Resource |
| Id | azure.dev_test_labs.disks |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
id | string | The identifier of the resource. |
name | string | The name of the resource. |
createdDate | string (date-time) | The creation date of the disk. |
diskBlobName | string | When backed by a blob, the name of the VHD blob without extension. |
diskSizeGiB | integer | The size of the disk in Gibibytes. |
diskType | string | The storage type for the disk (i.e. Standard, Premium). Known values are: "Standard", "Premium", and "StandardSSD". |
diskUri | string | When backed by a blob, the URI of underlying blob. |
hostCaching | string | The host caching policy of the disk (i.e. None, ReadOnly, ReadWrite). |
leasedByLabVmId | string | The resource ID of the VM to which this disk is leased. |
location | string | The location of the resource. |
managedDiskId | string | When backed by managed disk, this is the ID of the compute disk resource. |
provisioningState | string | The provisioning status of the resource. |
storageAccountId | string | When backed by a blob, the storage account where the blob is. |
tags | object | The tags of the resource. |
type | string | The type of the resource. |
uniqueIdentifier | string | The unique immutable identifier of a resource (Guid). |
| Name | Datatype | Description |
|---|---|---|
id | string | The identifier of the resource. |
name | string | The name of the resource. |
createdDate | string (date-time) | The creation date of the disk. |
diskBlobName | string | When backed by a blob, the name of the VHD blob without extension. |
diskSizeGiB | integer | The size of the disk in Gibibytes. |
diskType | string | The storage type for the disk (i.e. Standard, Premium). Known values are: "Standard", "Premium", and "StandardSSD". |
diskUri | string | When backed by a blob, the URI of underlying blob. |
hostCaching | string | The host caching policy of the disk (i.e. None, ReadOnly, ReadWrite). |
leasedByLabVmId | string | The resource ID of the VM to which this disk is leased. |
location | string | The location of the resource. |
managedDiskId | string | When backed by managed disk, this is the ID of the compute disk resource. |
provisioningState | string | The provisioning status of the resource. |
storageAccountId | string | When backed by a blob, the storage account where the blob is. |
tags | object | The tags of the resource. |
type | string | The type of the resource. |
uniqueIdentifier | string | The unique immutable identifier of a resource (Guid). |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | resource_group_name, lab_name, user_name, name, subscription_id | $expand | Get disk. |
list | select | resource_group_name, lab_name, user_name, subscription_id | $expand, $filter, $top, $orderby | List disks in a given user profile. |
create_or_update | insert | resource_group_name, lab_name, user_name, name, subscription_id | Create or replace an existing disk. This operation can take a while to complete. | |
update | update | resource_group_name, lab_name, user_name, name, subscription_id | Allows modifying tags of disks. All other properties will be ignored. | |
create_or_update | replace | resource_group_name, lab_name, user_name, name, subscription_id | Create or replace an existing disk. This operation can take a while to complete. | |
delete | delete | resource_group_name, lab_name, user_name, name, subscription_id | Delete disk. This operation can take a while to complete. | |
attach | exec | resource_group_name, lab_name, user_name, name, subscription_id | Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. | |
detach | exec | resource_group_name, lab_name, user_name, name, subscription_id | Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
lab_name | string | The name of the lab. Required. |
name | string | The name of the disk. Required. |
resource_group_name | string | The name of the resource group. Required. |
subscription_id | string | |
user_name | string | The name of the user profile. Required. |
$expand | string | Specify the $expand query. Example: 'properties($select=diskType)'. Default value is None. |
$filter | string | The filter to apply to the operation. Example: '$filter=contains(name,'myName'). Default value is None. |
$orderby | string | The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. Default value is None. |
$top | integer | The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. |
SELECT examples
- get
- list
Get disk.
SELECT
id,
name,
createdDate,
diskBlobName,
diskSizeGiB,
diskType,
diskUri,
hostCaching,
leasedByLabVmId,
location,
managedDiskId,
provisioningState,
storageAccountId,
tags,
type,
uniqueIdentifier
FROM azure.dev_test_labs.disks
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND lab_name = '{{ lab_name }}' -- required
AND user_name = '{{ user_name }}' -- required
AND name = '{{ name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
AND $expand = '{{ $expand }}'
;
List disks in a given user profile.
SELECT
id,
name,
createdDate,
diskBlobName,
diskSizeGiB,
diskType,
diskUri,
hostCaching,
leasedByLabVmId,
location,
managedDiskId,
provisioningState,
storageAccountId,
tags,
type,
uniqueIdentifier
FROM azure.dev_test_labs.disks
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND lab_name = '{{ lab_name }}' -- required
AND user_name = '{{ user_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
AND $expand = '{{ $expand }}'
AND $filter = '{{ $filter }}'
AND $top = '{{ $top }}'
AND $orderby = '{{ $orderby }}'
;
INSERT examples
- create_or_update
- Manifest
Create or replace an existing disk. This operation can take a while to complete.
INSERT INTO azure.dev_test_labs.disks (
location,
tags,
properties,
resource_group_name,
lab_name,
user_name,
name,
subscription_id
)
SELECT
'{{ location }}',
'{{ tags }}',
'{{ properties }}',
'{{ resource_group_name }}',
'{{ lab_name }}',
'{{ user_name }}',
'{{ name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
location,
properties,
tags,
type
;
# Description fields are for documentation purposes
- name: disks
props:
- name: resource_group_name
value: "{{ resource_group_name }}"
description: Required parameter for the disks resource.
- name: lab_name
value: "{{ lab_name }}"
description: Required parameter for the disks resource.
- name: user_name
value: "{{ user_name }}"
description: Required parameter for the disks resource.
- name: name
value: "{{ name }}"
description: Required parameter for the disks resource.
- name: subscription_id
value: "{{ subscription_id }}"
description: Required parameter for the disks resource.
- name: location
value: "{{ location }}"
description: |
The location of the resource.
- name: tags
value: "{{ tags }}"
description: |
The tags of the resource.
- name: properties
value:
diskType: "{{ diskType }}"
diskSizeGiB: {{ diskSizeGiB }}
leasedByLabVmId: "{{ leasedByLabVmId }}"
diskBlobName: "{{ diskBlobName }}"
diskUri: "{{ diskUri }}"
storageAccountId: "{{ storageAccountId }}"
hostCaching: "{{ hostCaching }}"
managedDiskId: "{{ managedDiskId }}"
UPDATE examples
- update
Allows modifying tags of disks. All other properties will be ignored.
UPDATE azure.dev_test_labs.disks
SET
-- No updatable properties
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND lab_name = '{{ lab_name }}' --required
AND user_name = '{{ user_name }}' --required
AND name = '{{ name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
location,
properties,
tags,
type;
REPLACE examples
- create_or_update
Create or replace an existing disk. This operation can take a while to complete.
REPLACE azure.dev_test_labs.disks
SET
location = '{{ location }}',
tags = '{{ tags }}',
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND lab_name = '{{ lab_name }}' --required
AND user_name = '{{ user_name }}' --required
AND name = '{{ name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
location,
properties,
tags,
type;
DELETE examples
- delete
Delete disk. This operation can take a while to complete.
DELETE FROM azure.dev_test_labs.disks
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND lab_name = '{{ lab_name }}' --required
AND user_name = '{{ user_name }}' --required
AND name = '{{ name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;
Lifecycle Methods
- attach
- detach
Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete.
EXEC azure.dev_test_labs.disks.attach
@resource_group_name='{{ resource_group_name }}' --required,
@lab_name='{{ lab_name }}' --required,
@user_name='{{ user_name }}' --required,
@name='{{ name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete.
EXEC azure.dev_test_labs.disks.detach
@resource_group_name='{{ resource_group_name }}' --required,
@lab_name='{{ lab_name }}' --required,
@user_name='{{ user_name }}' --required,
@name='{{ name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;