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
idstringResource Id
namestringResource name
extendedLocationobjectThe extended location where the snapshot will be created. Extended location cannot be changed.
locationstringResource location
managedBystringUnused. Always Null.
propertiesobjectSnapshot resource properties.
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
tagsobjectResource tags
typestringResource type

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectsubscriptionId, resourceGroupName, snapshotNameGets information about a snapshot.
list_by_resource_groupselectsubscriptionId, resourceGroupNameLists snapshots under a resource group.
listselectsubscriptionIdLists snapshots under a subscription.
create_or_updateinsertsubscriptionId, resourceGroupName, snapshotNameCreates or updates a snapshot.
updateupdatesubscriptionId, resourceGroupName, snapshotNameUpdates (patches) a snapshot.
deletedeletesubscriptionId, resourceGroupName, snapshotNameDeletes a snapshot.
grant_accessexecsubscriptionId, resourceGroupName, snapshotName, access, durationInSecondsGrants access to a snapshot.
revoke_accessexecsubscriptionId, resourceGroupName, snapshotNameRevokes 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
resourceGroupNamestringThe name of the resource group.
snapshotNamestringThe 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.
subscriptionIdstringSubscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.

SELECT examples

Gets information about a snapshot.

SELECT
id,
name,
extendedLocation,
location,
managedBy,
properties,
sku,
tags,
type
FROM azure.compute.snapshots
WHERE subscriptionId = '{{ subscriptionId }}' -- required
AND resourceGroupName = '{{ resourceGroupName }}' -- required
AND snapshotName = '{{ snapshotName }}' -- required
;

INSERT examples

Creates or updates a snapshot.

INSERT INTO azure.compute.snapshots (
data__sku,
data__extendedLocation,
data__properties,
data__location,
data__tags,
subscriptionId,
resourceGroupName,
snapshotName
)
SELECT
'{{ sku }}',
'{{ extendedLocation }}',
'{{ properties }}',
'{{ location }}',
'{{ tags }}',
'{{ subscriptionId }}',
'{{ resourceGroupName }}',
'{{ snapshotName }}'
RETURNING
id,
name,
extendedLocation,
location,
managedBy,
properties,
sku,
tags,
type
;

UPDATE examples

Updates (patches) a snapshot.

UPDATE azure.compute.snapshots
SET
data__properties = '{{ properties }}',
data__tags = '{{ tags }}',
data__sku = '{{ sku }}'
WHERE
subscriptionId = '{{ subscriptionId }}' --required
AND resourceGroupName = '{{ resourceGroupName }}' --required
AND snapshotName = '{{ snapshotName }}' --required
RETURNING
id,
name,
extendedLocation,
location,
managedBy,
properties,
sku,
tags,
type;

DELETE examples

Deletes a snapshot.

DELETE FROM azure.compute.snapshots
WHERE subscriptionId = '{{ subscriptionId }}' --required
AND resourceGroupName = '{{ resourceGroupName }}' --required
AND snapshotName = '{{ snapshotName }}' --required
;

Lifecycle Methods

Grants access to a snapshot.

EXEC azure.compute.snapshots.grant_access 
@subscriptionId='{{ subscriptionId }}' --required,
@resourceGroupName='{{ resourceGroupName }}' --required,
@snapshotName='{{ snapshotName }}' --required
@@json=
'{
"access": "{{ access }}",
"durationInSeconds": {{ durationInSeconds }},
"getSecureVMGuestStateSAS": {{ getSecureVMGuestStateSAS }},
"fileFormat": "{{ fileFormat }}"
}'
;