Microsoft.Compute snapshots

Template format

To create a Microsoft.Compute/snapshots resource, add the following JSON to the resources section of your template.

{
  "name": "string",
  "type": "Microsoft.Compute/snapshots",
  "apiVersion": "2020-06-30",
  "location": "string",
  "tags": {},
  "sku": {
    "name": "string"
  },
  "properties": {
    "osType": "string",
    "hyperVGeneration": "string",
    "creationData": {
      "createOption": "string",
      "storageAccountId": "string",
      "imageReference": {
        "id": "string",
        "lun": "integer"
      },
      "galleryImageReference": {
        "id": "string",
        "lun": "integer"
      },
      "sourceUri": "string",
      "sourceResourceId": "string",
      "uploadSizeBytes": "integer",
      "logicalSectorSize": "integer"
    },
    "diskSizeGB": "integer",
    "diskState": "string",
    "encryptionSettingsCollection": {
      "enabled": "boolean",
      "encryptionSettings": [
        {
          "diskEncryptionKey": {
            "sourceVault": {
              "id": "string"
            },
            "secretUrl": "string"
          },
          "keyEncryptionKey": {
            "sourceVault": {
              "id": "string"
            },
            "keyUrl": "string"
          }
        }
      ],
      "encryptionSettingsVersion": "string"
    },
    "incremental": "boolean",
    "encryption": {
      "diskEncryptionSetId": "string",
      "type": "string"
    },
    "networkAccessPolicy": "string",
    "diskAccessId": "string"
  }
}

Property values

The following tables describe the values you need to set in the schema.

Microsoft.Compute/snapshots object

Name Type Required Value
name string Yes 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.
type enum Yes Microsoft.Compute/snapshots
apiVersion enum Yes 2020-06-30
location string Yes Resource location
tags object No Resource tags
sku object No SnapshotSku object
properties object Yes SnapshotProperties object

SnapshotSku object

Name Type Required Value
name enum No The sku name. - Standard_LRS, Premium_LRS, Standard_ZRS

SnapshotProperties object

Name Type Required Value
osType enum No The Operating System type. - Windows or Linux
hyperVGeneration enum No The hypervisor generation of the Virtual Machine. Applicable to OS disks only. - V1 or V2
creationData object Yes Disk source information. CreationData information cannot be changed after the disk has been created. - CreationData object
diskSizeGB integer No 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 enum No The state of the snapshot. - Unattached, Attached, Reserved, ActiveSAS, ReadyToUpload, ActiveUpload
encryptionSettingsCollection object No Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. - EncryptionSettingsCollection object
incremental boolean No Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed.
encryption object No Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. - Encryption object
networkAccessPolicy enum No AllowAll, AllowPrivate, DenyAll
diskAccessId string No ARM id of the DiskAccess resource for using private endpoints on disks.

CreationData object

Name Type Required Value
createOption enum Yes This enumerates the possible sources of a disk's creation. - Empty, Attach, FromImage, Import, Copy, Restore, Upload
storageAccountId string No Required if createOption is Import. The Azure Resource Manager identifier of the storage account containing the blob to import as a disk.
imageReference object No Disk source information. - ImageDiskReference object
galleryImageReference object No Required if creating from a Gallery Image. The id of the ImageDiskReference will be the ARM id of the shared galley image version from which to create a disk. - ImageDiskReference object
sourceUri string No If createOption is Import, this is the URI of a blob to be imported into a managed disk.
sourceResourceId string No If createOption is Copy, this is the ARM id of the source snapshot or disk.
uploadSizeBytes integer No If createOption is Upload, this is the size of the contents of the upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer).
logicalSectorSize integer No Logical sector size in bytes for Ultra disks. Supported values are 512 ad 4096. 4096 is the default.

EncryptionSettingsCollection object

Name Type Required Value
enabled boolean Yes Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged.
encryptionSettings array No A collection of encryption settings, one for each disk volume. - EncryptionSettingsElement object
encryptionSettingsVersion string No Describes what type of encryption is used for the disks. Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption with AAD app.'1.1' corresponds to Azure Disk Encryption.

Encryption object

Name Type Required Value
diskEncryptionSetId string No ResourceId of the disk encryption set to use for enabling encryption at rest.
type enum No EncryptionAtRestWithPlatformKey, EncryptionAtRestWithCustomerKey, EncryptionAtRestWithPlatformAndCustomerKeys

ImageDiskReference object

Name Type Required Value
id string Yes A relative uri containing either a Platform Image Repository or user image reference.
lun integer No If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null.

EncryptionSettingsElement object

Name Type Required Value
diskEncryptionKey object No Key Vault Secret Url and vault id of the disk encryption key - KeyVaultAndSecretReference object
keyEncryptionKey object No Key Vault Key Url and vault id of the key encryption key. KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. - KeyVaultAndKeyReference object

KeyVaultAndSecretReference object

Name Type Required Value
sourceVault object Yes Resource id of the KeyVault containing the key or secret - SourceVault object
secretUrl string Yes Url pointing to a key or secret in KeyVault

KeyVaultAndKeyReference object

Name Type Required Value
sourceVault object Yes Resource id of the KeyVault containing the key or secret - SourceVault object
keyUrl string Yes Url pointing to a key or secret in KeyVault

SourceVault object

Name Type Required Value
id string No Resource Id