Skip to main content

snapshots

Creates, updates, deletes, gets or lists a snapshots resource.

Overview

Namesnapshots
TypeResource
Idazure.compute.snapshots

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringFully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
namestringThe name of the resource.
completionPercentnumberPercentage complete for the background copy when a resource is created via the CopyStart operation.
copyCompletionErrorobjectIndicates the error details if the background copy of a resource created via the CopyStart operation fails.
creationDataobjectDisk source information. CreationData information cannot be changed after the disk has been created. Required.
dataAccessAuthModestringAdditional authentication requirements when exporting or uploading to a disk or snapshot. Known values are: "AzureActiveDirectory" and "None". (AzureActiveDirectory, None)
diskAccessIdstringARM id of the DiskAccess resource for using private endpoints on disks.
diskSizeBytesintegerThe size of the disk in bytes. This field is read only.
diskSizeGBintegerIf 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.
diskStatestringThe state of the snapshot. Known values are: "Unattached", "Attached", "Reserved", "Frozen", "ActiveSAS", "ActiveSASFrozen", "ReadyToUpload", and "ActiveUpload". (Unattached, Attached, Reserved, Frozen, ActiveSAS, ActiveSASFrozen, ReadyToUpload, ActiveUpload)
encryptionobjectEncryption property can be used to encrypt data at rest with customer managed keys or platform managed keys.
encryptionSettingsCollectionobjectEncryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot.
extendedLocationobjectThe extended location where the snapshot will be created. Extended location cannot be changed.
hyperVGenerationstringThe hypervisor generation of the Virtual Machine. Applicable to OS disks only. Known values are: "V1" and "V2". (V1, V2)
incrementalbooleanWhether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed.
incrementalSnapshotFamilyIdstringIncremental 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.
locationstringThe geo-location where the resource lives. Required.
managedBystringUnused. Always Null.
networkAccessPolicystringPolicy for accessing the disk via network. Known values are: "AllowAll", "AllowPrivate", and "DenyAll". (AllowAll, AllowPrivate, DenyAll)
osTypestringThe Operating System type. Known values are: "Windows" and "Linux". (Windows, Linux)
provisioningStatestringThe disk provisioning state.
publicNetworkAccessstringPolicy for controlling export on the disk. Known values are: "Enabled" and "Disabled". (Enabled, Disabled)
purchasePlanobjectPurchase plan information for the image from which the source disk for the snapshot was originally created.
securityProfileobjectContains the security related information for the resource.
skuobjectThe 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.
snapshotAccessStatestringThe 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)
supportedCapabilitiesobjectList of supported capabilities for the image from which the source disk from the snapshot was originally created.
supportsHibernationbooleanIndicates the OS on a snapshot supports hibernation.
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
tagsobjectResource tags.
timeCreatedstring (date-time)The time when the snapshot was created.
typestringThe type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".
uniqueIdstringUnique Guid identifying the resource.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresource_group_name, snapshot_name, subscription_idGets information about a snapshot.
list_by_resource_groupselectresource_group_name, subscription_idLists snapshots under a resource group.
listselectsubscription_idLists snapshots under a subscription.
create_or_updateinsertresource_group_name, snapshot_name, subscription_id, locationCreates or updates a snapshot.
updateupdateresource_group_name, snapshot_name, subscription_idUpdates (patches) a snapshot.
create_or_updatereplaceresource_group_name, snapshot_name, subscription_id, locationCreates or updates a snapshot.
deletedeleteresource_group_name, snapshot_name, subscription_idDeletes a snapshot.
grant_accessexecresource_group_name, snapshot_name, subscription_id, access, durationInSecondsGrants access to a snapshot.
revoke_accessexecresource_group_name, snapshot_name, subscription_idRevokes 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.

NameDatatypeDescription
resource_group_namestringThe name of the resource group. The name is case insensitive. Required.
snapshot_namestringThe 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_idstring

SELECT examples

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
;

INSERT examples

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
;

UPDATE examples

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

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

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

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 }}"
}'
;