disks
Creates, updates, deletes, gets or lists a disks
resource.
Overview
Name | disks |
Type | Resource |
Id | azure.compute.disks |
Fields
The following fields are returned by SELECT
queries:
- get
- list_by_resource_group
- list
Name | Datatype | Description |
---|---|---|
id | string | Resource Id |
name | string | Resource name |
extendedLocation | object | The extended location where the disk will be created. Extended location cannot be changed. |
location | string | Resource location |
managedBy | string | A relative URI containing the ID of the VM that has the disk attached. |
managedByExtended | array | List of relative URIs containing the IDs of the VMs that have the disk attached. maxShares should be set to a value greater than one for disks to allow attaching them to multiple VMs. |
properties | object | Disk resource properties. |
sku | object | The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS. |
tags | object | Resource tags |
type | string | Resource type |
zones | array | The Logical zone list for Disk. |
Name | Datatype | Description |
---|---|---|
id | string | Resource Id |
name | string | Resource name |
extendedLocation | object | The extended location where the disk will be created. Extended location cannot be changed. |
location | string | Resource location |
managedBy | string | A relative URI containing the ID of the VM that has the disk attached. |
managedByExtended | array | List of relative URIs containing the IDs of the VMs that have the disk attached. maxShares should be set to a value greater than one for disks to allow attaching them to multiple VMs. |
properties | object | Disk resource properties. |
sku | object | The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS. |
tags | object | Resource tags |
type | string | Resource type |
zones | array | The Logical zone list for Disk. |
Name | Datatype | Description |
---|---|---|
id | string | Resource Id |
name | string | Resource name |
extendedLocation | object | The extended location where the disk will be created. Extended location cannot be changed. |
location | string | Resource location |
managedBy | string | A relative URI containing the ID of the VM that has the disk attached. |
managedByExtended | array | List of relative URIs containing the IDs of the VMs that have the disk attached. maxShares should be set to a value greater than one for disks to allow attaching them to multiple VMs. |
properties | object | Disk resource properties. |
sku | object | The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS. |
tags | object | Resource tags |
type | string | Resource type |
zones | array | The Logical zone list for Disk. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | subscriptionId , resourceGroupName , diskName | Gets information about a disk. | |
list_by_resource_group | select | subscriptionId , resourceGroupName | Lists all the disks under a resource group. | |
list | select | subscriptionId | Lists all the disks under a subscription. | |
create_or_update | insert | subscriptionId , resourceGroupName , diskName | Creates or updates a disk. | |
update | update | subscriptionId , resourceGroupName , diskName | Updates (patches) a disk. | |
delete | delete | subscriptionId , resourceGroupName , diskName | Deletes a disk. | |
grant_access | exec | subscriptionId , resourceGroupName , diskName , access , durationInSeconds | Grants access to a disk. | |
revoke_access | exec | subscriptionId , resourceGroupName , diskName | Revokes access to a disk. |
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 |
---|---|---|
diskName | string | The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. |
resourceGroupName | string | The name of the resource group. |
subscriptionId | string | Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. |
SELECT
examples
- get
- list_by_resource_group
- list
Gets information about a disk.
SELECT
id,
name,
extendedLocation,
location,
managedBy,
managedByExtended,
properties,
sku,
tags,
type,
zones
FROM azure.compute.disks
WHERE subscriptionId = '{{ subscriptionId }}' -- required
AND resourceGroupName = '{{ resourceGroupName }}' -- required
AND diskName = '{{ diskName }}' -- required
;
Lists all the disks under a resource group.
SELECT
id,
name,
extendedLocation,
location,
managedBy,
managedByExtended,
properties,
sku,
tags,
type,
zones
FROM azure.compute.disks
WHERE subscriptionId = '{{ subscriptionId }}' -- required
AND resourceGroupName = '{{ resourceGroupName }}' -- required
;
Lists all the disks under a subscription.
SELECT
id,
name,
extendedLocation,
location,
managedBy,
managedByExtended,
properties,
sku,
tags,
type,
zones
FROM azure.compute.disks
WHERE subscriptionId = '{{ subscriptionId }}' -- required
;
INSERT
examples
- create_or_update
- Manifest
Creates or updates a disk.
INSERT INTO azure.compute.disks (
data__sku,
data__zones,
data__extendedLocation,
data__properties,
data__location,
data__tags,
subscriptionId,
resourceGroupName,
diskName
)
SELECT
'{{ sku }}',
'{{ zones }}',
'{{ extendedLocation }}',
'{{ properties }}',
'{{ location }}',
'{{ tags }}',
'{{ subscriptionId }}',
'{{ resourceGroupName }}',
'{{ diskName }}'
RETURNING
id,
name,
extendedLocation,
location,
managedBy,
managedByExtended,
properties,
sku,
tags,
type,
zones
;
# Description fields are for documentation purposes
- name: disks
props:
- name: subscriptionId
value: string
description: Required parameter for the disks resource.
- name: resourceGroupName
value: string
description: Required parameter for the disks resource.
- name: diskName
value: string
description: Required parameter for the disks resource.
- name: sku
value: object
description: |
The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS.
- name: zones
value: array
description: |
The Logical zone list for Disk.
- name: extendedLocation
value: object
description: |
The extended location where the disk will be created. Extended location cannot be changed.
- name: properties
value: object
description: |
Disk resource properties.
- name: location
value: string
description: |
Resource location
- name: tags
value: object
description: |
Resource tags
UPDATE
examples
- update
Updates (patches) a disk.
UPDATE azure.compute.disks
SET
data__properties = '{{ properties }}',
data__tags = '{{ tags }}',
data__sku = '{{ sku }}'
WHERE
subscriptionId = '{{ subscriptionId }}' --required
AND resourceGroupName = '{{ resourceGroupName }}' --required
AND diskName = '{{ diskName }}' --required
RETURNING
id,
name,
extendedLocation,
location,
managedBy,
managedByExtended,
properties,
sku,
tags,
type,
zones;
DELETE
examples
- delete
Deletes a disk.
DELETE FROM azure.compute.disks
WHERE subscriptionId = '{{ subscriptionId }}' --required
AND resourceGroupName = '{{ resourceGroupName }}' --required
AND diskName = '{{ diskName }}' --required
;
Lifecycle Methods
- grant_access
- revoke_access
Grants access to a disk.
EXEC azure.compute.disks.grant_access
@subscriptionId='{{ subscriptionId }}' --required,
@resourceGroupName='{{ resourceGroupName }}' --required,
@diskName='{{ diskName }}' --required
@@json=
'{
"access": "{{ access }}",
"durationInSeconds": {{ durationInSeconds }},
"getSecureVMGuestStateSAS": {{ getSecureVMGuestStateSAS }},
"fileFormat": "{{ fileFormat }}"
}'
;
Revokes access to a disk.
EXEC azure.compute.disks.revoke_access
@subscriptionId='{{ subscriptionId }}' --required,
@resourceGroupName='{{ resourceGroupName }}' --required,
@diskName='{{ diskName }}' --required
;