Microsoft.Compute/disks template reference

API Version: 2017-03-30

Template format

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

{
  "name": "string",
  "type": "Microsoft.Compute/disks",
  "apiVersion": "2017-03-30",
  "location": "string",
  "tags": {},
  "sku": {
    "name": "string"
  },
  "properties": {
    "osType": "string",
    "creationData": {
      "createOption": "string",
      "storageAccountId": "string",
      "imageReference": {
        "id": "string",
        "lun": "integer"
      },
      "sourceUri": "string",
      "sourceResourceId": "string"
    },
    "diskSizeGB": "integer",
    "encryptionSettings": {
      "enabled": boolean,
      "diskEncryptionKey": {
        "sourceVault": {
          "id": "string"
        },
        "secretUrl": "string"
      },
      "keyEncryptionKey": {
        "sourceVault": {
          "id": "string"
        },
        "keyUrl": "string"
      }
    }
  }
}

Property values

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

Microsoft.Compute/disks object

Name Type Required Value
name string Yes The name of the disk within the given subscription and resource group.
type enum Yes Microsoft.Compute/disks
apiVersion enum Yes 2017-03-30
location string Yes Resource location
tags object No Resource tags
sku object No DiskSku object
properties object Yes DiskProperties object

DiskSku object

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

DiskProperties object

Name Type Required Value
osType enum No The Operating System type. - Windows or Linux
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 VHD 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.
encryptionSettings object No Encryption settings for disk or snapshot - EncryptionSettings object

CreationData object

Name Type Required Value
createOption enum Yes This enumerates the possible sources of a disk's creation. - Empty, Attach, FromImage, Import, Copy
storageAccountId string No If createOption is Import, the Azure Resource Manager identifier of the storage account containing the blob to import as a disk. Required only if the blob is in a different subscription
imageReference object No Disk source information. - ImageDiskReference object
sourceUri string No If creationOption 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.

EncryptionSettings object

Name Type Required Value
enabled boolean No 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.
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 - KeyVaultAndKeyReference object

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.

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

Quickstart templates

For example templates, see Compute templates.