snapshots
Creates, updates, deletes, gets or lists a snapshots resource.
Overview
| Name | snapshots |
| Type | Resource |
| Id | azure.compute.snapshots |
Fields
The following fields are returned by SELECT queries:
- get
- list_by_resource_group
- list
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
completionPercent | number | Percentage complete for the background copy when a resource is created via the CopyStart operation. |
copyCompletionError | object | Indicates the error details if the background copy of a resource created via the CopyStart operation fails. |
creationData | object | Disk source information. CreationData information cannot be changed after the disk has been created. Required. |
dataAccessAuthMode | string | Additional authentication requirements when exporting or uploading to a disk or snapshot. Known values are: "AzureActiveDirectory" and "None". (AzureActiveDirectory, None) |
diskAccessId | string | ARM id of the DiskAccess resource for using private endpoints on disks. |
diskSizeBytes | integer | The size of the disk in bytes. This field is read only. |
diskSizeGB | integer | If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. |
diskState | string | The state of the snapshot. Known values are: "Unattached", "Attached", "Reserved", "Frozen", "ActiveSAS", "ActiveSASFrozen", "ReadyToUpload", and "ActiveUpload". (Unattached, Attached, Reserved, Frozen, ActiveSAS, ActiveSASFrozen, ReadyToUpload, ActiveUpload) |
encryption | object | Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. |
encryptionSettingsCollection | object | Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. |
extendedLocation | object | The extended location where the snapshot will be created. Extended location cannot be changed. |
hyperVGeneration | string | The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Known values are: "V1" and "V2". (V1, V2) |
incremental | boolean | Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed. |
incrementalSnapshotFamilyId | string | Incremental snapshots for a disk share an incremental snapshot family id. The Get Page Range Diff API can only be called on incremental snapshots with the same family id. |
location | string | The geo-location where the resource lives. Required. |
managedBy | string | Unused. Always Null. |
networkAccessPolicy | string | Policy for accessing the disk via network. Known values are: "AllowAll", "AllowPrivate", and "DenyAll". (AllowAll, AllowPrivate, DenyAll) |
osType | string | The Operating System type. Known values are: "Windows" and "Linux". (Windows, Linux) |
provisioningState | string | The disk provisioning state. |
publicNetworkAccess | string | Policy for controlling export on the disk. Known values are: "Enabled" and "Disabled". (Enabled, Disabled) |
purchasePlan | object | Purchase plan information for the image from which the source disk for the snapshot was originally created. |
securityProfile | object | Contains the security related information for the resource. |
sku | object | The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot. |
snapshotAccessState | string | The state of snapshot which determines the access availability of the snapshot. Known values are: "Unknown", "Pending", "Available", "InstantAccess", and "AvailableWithInstantAccess". (Unknown, Pending, Available, InstantAccess, AvailableWithInstantAccess) |
supportedCapabilities | object | List of supported capabilities for the image from which the source disk from the snapshot was originally created. |
supportsHibernation | boolean | Indicates the OS on a snapshot supports hibernation. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
tags | object | Resource tags. |
timeCreated | string (date-time) | The time when the snapshot was created. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
uniqueId | string | Unique Guid identifying the resource. |
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
completionPercent | number | Percentage complete for the background copy when a resource is created via the CopyStart operation. |
copyCompletionError | object | Indicates the error details if the background copy of a resource created via the CopyStart operation fails. |
creationData | object | Disk source information. CreationData information cannot be changed after the disk has been created. Required. |
dataAccessAuthMode | string | Additional authentication requirements when exporting or uploading to a disk or snapshot. Known values are: "AzureActiveDirectory" and "None". (AzureActiveDirectory, None) |
diskAccessId | string | ARM id of the DiskAccess resource for using private endpoints on disks. |
diskSizeBytes | integer | The size of the disk in bytes. This field is read only. |
diskSizeGB | integer | If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. |
diskState | string | The state of the snapshot. Known values are: "Unattached", "Attached", "Reserved", "Frozen", "ActiveSAS", "ActiveSASFrozen", "ReadyToUpload", and "ActiveUpload". (Unattached, Attached, Reserved, Frozen, ActiveSAS, ActiveSASFrozen, ReadyToUpload, ActiveUpload) |
encryption | object | Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. |
encryptionSettingsCollection | object | Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. |
extendedLocation | object | The extended location where the snapshot will be created. Extended location cannot be changed. |
hyperVGeneration | string | The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Known values are: "V1" and "V2". (V1, V2) |
incremental | boolean | Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed. |
incrementalSnapshotFamilyId | string | Incremental snapshots for a disk share an incremental snapshot family id. The Get Page Range Diff API can only be called on incremental snapshots with the same family id. |
location | string | The geo-location where the resource lives. Required. |
managedBy | string | Unused. Always Null. |
networkAccessPolicy | string | Policy for accessing the disk via network. Known values are: "AllowAll", "AllowPrivate", and "DenyAll". (AllowAll, AllowPrivate, DenyAll) |
osType | string | The Operating System type. Known values are: "Windows" and "Linux". (Windows, Linux) |
provisioningState | string | The disk provisioning state. |
publicNetworkAccess | string | Policy for controlling export on the disk. Known values are: "Enabled" and "Disabled". (Enabled, Disabled) |
purchasePlan | object | Purchase plan information for the image from which the source disk for the snapshot was originally created. |
securityProfile | object | Contains the security related information for the resource. |
sku | object | The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot. |
snapshotAccessState | string | The state of snapshot which determines the access availability of the snapshot. Known values are: "Unknown", "Pending", "Available", "InstantAccess", and "AvailableWithInstantAccess". (Unknown, Pending, Available, InstantAccess, AvailableWithInstantAccess) |
supportedCapabilities | object | List of supported capabilities for the image from which the source disk from the snapshot was originally created. |
supportsHibernation | boolean | Indicates the OS on a snapshot supports hibernation. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
tags | object | Resource tags. |
timeCreated | string (date-time) | The time when the snapshot was created. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
uniqueId | string | Unique Guid identifying the resource. |
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
completionPercent | number | Percentage complete for the background copy when a resource is created via the CopyStart operation. |
copyCompletionError | object | Indicates the error details if the background copy of a resource created via the CopyStart operation fails. |
creationData | object | Disk source information. CreationData information cannot be changed after the disk has been created. Required. |
dataAccessAuthMode | string | Additional authentication requirements when exporting or uploading to a disk or snapshot. Known values are: "AzureActiveDirectory" and "None". (AzureActiveDirectory, None) |
diskAccessId | string | ARM id of the DiskAccess resource for using private endpoints on disks. |
diskSizeBytes | integer | The size of the disk in bytes. This field is read only. |
diskSizeGB | integer | If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. |
diskState | string | The state of the snapshot. Known values are: "Unattached", "Attached", "Reserved", "Frozen", "ActiveSAS", "ActiveSASFrozen", "ReadyToUpload", and "ActiveUpload". (Unattached, Attached, Reserved, Frozen, ActiveSAS, ActiveSASFrozen, ReadyToUpload, ActiveUpload) |
encryption | object | Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. |
encryptionSettingsCollection | object | Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. |
extendedLocation | object | The extended location where the snapshot will be created. Extended location cannot be changed. |
hyperVGeneration | string | The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Known values are: "V1" and "V2". (V1, V2) |
incremental | boolean | Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed. |
incrementalSnapshotFamilyId | string | Incremental snapshots for a disk share an incremental snapshot family id. The Get Page Range Diff API can only be called on incremental snapshots with the same family id. |
location | string | The geo-location where the resource lives. Required. |
managedBy | string | Unused. Always Null. |
networkAccessPolicy | string | Policy for accessing the disk via network. Known values are: "AllowAll", "AllowPrivate", and "DenyAll". (AllowAll, AllowPrivate, DenyAll) |
osType | string | The Operating System type. Known values are: "Windows" and "Linux". (Windows, Linux) |
provisioningState | string | The disk provisioning state. |
publicNetworkAccess | string | Policy for controlling export on the disk. Known values are: "Enabled" and "Disabled". (Enabled, Disabled) |
purchasePlan | object | Purchase plan information for the image from which the source disk for the snapshot was originally created. |
securityProfile | object | Contains the security related information for the resource. |
sku | object | The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot. |
snapshotAccessState | string | The state of snapshot which determines the access availability of the snapshot. Known values are: "Unknown", "Pending", "Available", "InstantAccess", and "AvailableWithInstantAccess". (Unknown, Pending, Available, InstantAccess, AvailableWithInstantAccess) |
supportedCapabilities | object | List of supported capabilities for the image from which the source disk from the snapshot was originally created. |
supportsHibernation | boolean | Indicates the OS on a snapshot supports hibernation. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
tags | object | Resource tags. |
timeCreated | string (date-time) | The time when the snapshot was created. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
uniqueId | string | Unique Guid identifying the resource. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | resource_group_name, snapshot_name, subscription_id | Gets information about a snapshot. | |
list_by_resource_group | select | resource_group_name, subscription_id | Lists snapshots under a resource group. | |
list | select | subscription_id | Lists snapshots under a subscription. | |
create_or_update | insert | resource_group_name, snapshot_name, subscription_id, location | Creates or updates a snapshot. | |
update | update | resource_group_name, snapshot_name, subscription_id | Updates (patches) a snapshot. | |
create_or_update | replace | resource_group_name, snapshot_name, subscription_id, location | Creates or updates a snapshot. | |
delete | delete | resource_group_name, snapshot_name, subscription_id | Deletes a snapshot. | |
grant_access | exec | resource_group_name, snapshot_name, subscription_id, access, durationInSeconds | Grants access to a snapshot. | |
revoke_access | exec | resource_group_name, snapshot_name, subscription_id | Revokes access to a snapshot. |
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 |
|---|---|---|
resource_group_name | string | The name of the resource group. The name is case insensitive. Required. |
snapshot_name | string | The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. Required. |
subscription_id | string |
SELECT examples
- get
- list_by_resource_group
- list
Gets information about a snapshot.
SELECT
id,
name,
completionPercent,
copyCompletionError,
creationData,
dataAccessAuthMode,
diskAccessId,
diskSizeBytes,
diskSizeGB,
diskState,
encryption,
encryptionSettingsCollection,
extendedLocation,
hyperVGeneration,
incremental,
incrementalSnapshotFamilyId,
location,
managedBy,
networkAccessPolicy,
osType,
provisioningState,
publicNetworkAccess,
purchasePlan,
securityProfile,
sku,
snapshotAccessState,
supportedCapabilities,
supportsHibernation,
systemData,
tags,
timeCreated,
type,
uniqueId
FROM azure.compute.snapshots
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND snapshot_name = '{{ snapshot_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;
Lists snapshots under a resource group.
SELECT
id,
name,
completionPercent,
copyCompletionError,
creationData,
dataAccessAuthMode,
diskAccessId,
diskSizeBytes,
diskSizeGB,
diskState,
encryption,
encryptionSettingsCollection,
extendedLocation,
hyperVGeneration,
incremental,
incrementalSnapshotFamilyId,
location,
managedBy,
networkAccessPolicy,
osType,
provisioningState,
publicNetworkAccess,
purchasePlan,
securityProfile,
sku,
snapshotAccessState,
supportedCapabilities,
supportsHibernation,
systemData,
tags,
timeCreated,
type,
uniqueId
FROM azure.compute.snapshots
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;
Lists snapshots under a subscription.
SELECT
id,
name,
completionPercent,
copyCompletionError,
creationData,
dataAccessAuthMode,
diskAccessId,
diskSizeBytes,
diskSizeGB,
diskState,
encryption,
encryptionSettingsCollection,
extendedLocation,
hyperVGeneration,
incremental,
incrementalSnapshotFamilyId,
location,
managedBy,
networkAccessPolicy,
osType,
provisioningState,
publicNetworkAccess,
purchasePlan,
securityProfile,
sku,
snapshotAccessState,
supportedCapabilities,
supportsHibernation,
systemData,
tags,
timeCreated,
type,
uniqueId
FROM azure.compute.snapshots
WHERE subscription_id = '{{ subscription_id }}' -- required
;
INSERT examples
- create_or_update
- Manifest
Creates or updates a snapshot.
INSERT INTO azure.compute.snapshots (
tags,
location,
properties,
sku,
extendedLocation,
resource_group_name,
snapshot_name,
subscription_id
)
SELECT
'{{ tags }}',
'{{ location }}' /* required */,
'{{ properties }}',
'{{ sku }}',
'{{ extendedLocation }}',
'{{ resource_group_name }}',
'{{ snapshot_name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
extendedLocation,
location,
managedBy,
properties,
sku,
systemData,
tags,
type
;
# Description fields are for documentation purposes
- name: snapshots
props:
- name: resource_group_name
value: "{{ resource_group_name }}"
description: Required parameter for the snapshots resource.
- name: snapshot_name
value: "{{ snapshot_name }}"
description: Required parameter for the snapshots resource.
- name: subscription_id
value: "{{ subscription_id }}"
description: Required parameter for the snapshots resource.
- name: tags
value: "{{ tags }}"
description: |
Resource tags.
- name: location
value: "{{ location }}"
description: |
The geo-location where the resource lives. Required.
- name: properties
description: |
Snapshot resource properties.
value:
timeCreated: "{{ timeCreated }}"
osType: "{{ osType }}"
hyperVGeneration: "{{ hyperVGeneration }}"
purchasePlan:
name: "{{ name }}"
publisher: "{{ publisher }}"
product: "{{ product }}"
promotionCode: "{{ promotionCode }}"
supportedCapabilities:
diskControllerTypes: "{{ diskControllerTypes }}"
acceleratedNetwork: {{ acceleratedNetwork }}
architecture: "{{ architecture }}"
supportedSecurityOption: "{{ supportedSecurityOption }}"
creationData:
createOption: "{{ createOption }}"
storageAccountId: "{{ storageAccountId }}"
imageReference:
id: "{{ id }}"
sharedGalleryImageId: "{{ sharedGalleryImageId }}"
communityGalleryImageId: "{{ communityGalleryImageId }}"
lun: {{ lun }}
galleryImageReference:
id: "{{ id }}"
sharedGalleryImageId: "{{ sharedGalleryImageId }}"
communityGalleryImageId: "{{ communityGalleryImageId }}"
lun: {{ lun }}
sourceUri: "{{ sourceUri }}"
sourceResourceId: "{{ sourceResourceId }}"
sourceUniqueId: "{{ sourceUniqueId }}"
uploadSizeBytes: {{ uploadSizeBytes }}
logicalSectorSize: {{ logicalSectorSize }}
securityDataUri: "{{ securityDataUri }}"
securityMetadataUri: "{{ securityMetadataUri }}"
performancePlus: {{ performancePlus }}
elasticSanResourceId: "{{ elasticSanResourceId }}"
provisionedBandwidthCopySpeed: "{{ provisionedBandwidthCopySpeed }}"
instantAccessDurationMinutes: {{ instantAccessDurationMinutes }}
diskSizeGB: {{ diskSizeGB }}
diskSizeBytes: {{ diskSizeBytes }}
diskState: "{{ diskState }}"
uniqueId: "{{ uniqueId }}"
encryptionSettingsCollection:
enabled: {{ enabled }}
encryptionSettings:
- diskEncryptionKey:
sourceVault:
id: "{{ id }}"
secretUrl: "{{ secretUrl }}"
keyEncryptionKey:
sourceVault:
id: "{{ id }}"
keyUrl: "{{ keyUrl }}"
encryptionSettingsVersion: "{{ encryptionSettingsVersion }}"
provisioningState: "{{ provisioningState }}"
incremental: {{ incremental }}
incrementalSnapshotFamilyId: "{{ incrementalSnapshotFamilyId }}"
encryption:
diskEncryptionSetId: "{{ diskEncryptionSetId }}"
type: "{{ type }}"
networkAccessPolicy: "{{ networkAccessPolicy }}"
diskAccessId: "{{ diskAccessId }}"
securityProfile:
securityType: "{{ securityType }}"
secureVMDiskEncryptionSetId: "{{ secureVMDiskEncryptionSetId }}"
supportsHibernation: {{ supportsHibernation }}
publicNetworkAccess: "{{ publicNetworkAccess }}"
completionPercent: {{ completionPercent }}
copyCompletionError:
errorCode: "{{ errorCode }}"
errorMessage: "{{ errorMessage }}"
dataAccessAuthMode: "{{ dataAccessAuthMode }}"
snapshotAccessState: "{{ snapshotAccessState }}"
- name: sku
description: |
The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot.
value:
name: "{{ name }}"
tier: "{{ tier }}"
- name: extendedLocation
description: |
The extended location where the snapshot will be created. Extended location cannot be changed.
value:
name: "{{ name }}"
type: "{{ type }}"
UPDATE examples
- update
Updates (patches) a snapshot.
UPDATE azure.compute.snapshots
SET
properties = '{{ properties }}',
tags = '{{ tags }}',
sku = '{{ sku }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND snapshot_name = '{{ snapshot_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
extendedLocation,
location,
managedBy,
properties,
sku,
systemData,
tags,
type;
REPLACE examples
- create_or_update
Creates or updates a snapshot.
REPLACE azure.compute.snapshots
SET
tags = '{{ tags }}',
location = '{{ location }}',
properties = '{{ properties }}',
sku = '{{ sku }}',
extendedLocation = '{{ extendedLocation }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND snapshot_name = '{{ snapshot_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
AND location = '{{ location }}' --required
RETURNING
id,
name,
extendedLocation,
location,
managedBy,
properties,
sku,
systemData,
tags,
type;
DELETE examples
- delete
Deletes a snapshot.
DELETE FROM azure.compute.snapshots
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND snapshot_name = '{{ snapshot_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;
Lifecycle Methods
- grant_access
- revoke_access
Grants access to a snapshot.
EXEC azure.compute.snapshots.grant_access
@resource_group_name='{{ resource_group_name }}' --required,
@snapshot_name='{{ snapshot_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
@@json=
'{
"access": "{{ access }}",
"durationInSeconds": {{ durationInSeconds }},
"getSecureVMGuestStateSAS": {{ getSecureVMGuestStateSAS }},
"fileFormat": "{{ fileFormat }}"
}'
;
Revokes access to a snapshot.
EXEC azure.compute.snapshots.revoke_access
@resource_group_name='{{ resource_group_name }}' --required,
@snapshot_name='{{ snapshot_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;