Disks - Create Or Update

Creates or updates a disk.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}?api-version=2019-03-01

URI Parameters

Name In Required Type Description
subscriptionId
path True
  • string

Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.

resourceGroupName
path True
  • string

The name of the resource group.

diskName
path True
  • string

The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters.

api-version
query True
  • string

Client Api Version.

Request Body

Name Required Type Description
location True
  • string

Resource location

properties.creationData True

Disk source information. CreationData information cannot be changed after the disk has been created.

properties.diskIOPSReadWrite
  • integer

The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes.

properties.diskMBpsReadWrite
  • integer

The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10.

properties.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.

properties.encryptionSettingsCollection

Encryption settings collection used for Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot.

properties.hyperVGeneration

The hypervisor generation of the Virtual Machine. Applicable to OS disks only.

properties.osType

The Operating System type.

sku

The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS.

tags
  • object

Resource tags

zones
  • string[]

The Logical zone list for Disk.

Responses

Name Type Description
200 OK

OK

202 Accepted

Accepted

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

Create a managed disk by copying a snapshot.
Create a managed disk by importing an unmanaged blob from a different subscription.
Create a managed disk by importing an unmanaged blob from the same subscription.
Create a managed disk from a platform image.
Create a managed disk from an existing managed disk in the same or different subscription.
Create a managed upload disk.
Create an empty managed disk.

Create a managed disk by copying a snapshot.

Sample Request

PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2019-03-01
{
  "location": "West US",
  "properties": {
    "creationData": {
      "createOption": "Copy",
      "sourceResourceId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"
    }
  }
}

Sample Response

{
  "name": "myDisk",
  "location": "West US",
  "properties": {
    "provisioningState": "Updating",
    "creationData": {
      "createOption": "Copy",
      "sourceResourceId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"
    }
  }
}
{
  "name": "myDisk",
  "location": "West US",
  "properties": {
    "provisioningState": "Updating",
    "creationData": {
      "createOption": "Copy",
      "sourceResourceId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"
    }
  }
}

Create a managed disk by importing an unmanaged blob from a different subscription.

Sample Request

PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2019-03-01
{
  "location": "West US",
  "properties": {
    "creationData": {
      "createOption": "Import",
      "storageAccountId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount",
      "sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"
    }
  }
}

Sample Response

{
  "name": "myDisk",
  "location": "West US",
  "properties": {
    "provisioningState": "Updating",
    "creationData": {
      "createOption": "Import",
      "storageAccountId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount",
      "sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"
    }
  }
}
{
  "name": "myDisk",
  "location": "West US",
  "properties": {
    "provisioningState": "Updating",
    "creationData": {
      "createOption": "Import",
      "storageAccountId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount",
      "sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"
    }
  }
}

Create a managed disk by importing an unmanaged blob from the same subscription.

Sample Request

PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2019-03-01
{
  "location": "West US",
  "properties": {
    "creationData": {
      "createOption": "Import",
      "sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"
    }
  }
}

Sample Response

{
  "name": "myDisk",
  "location": "West US",
  "properties": {
    "provisioningState": "Updating",
    "creationData": {
      "createOption": "Import",
      "sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"
    }
  }
}
{
  "name": "myDisk",
  "location": "West US",
  "properties": {
    "provisioningState": "Updating",
    "creationData": {
      "createOption": "Import",
      "sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"
    }
  }
}

Create a managed disk from a platform image.

Sample Request

PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2019-03-01
{
  "location": "West US",
  "properties": {
    "osType": "Windows",
    "creationData": {
      "createOption": "FromImage",
      "imageReference": {
        "id": "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}"
      }
    }
  }
}

Sample Response

{
  "name": "myDisk",
  "location": "West US",
  "properties": {
    "provisioningState": "Updating",
    "osType": "Windows",
    "creationData": {
      "createOption": "FromImage",
      "imageReference": {
        "id": "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}"
      }
    }
  }
}
{
  "name": "myDisk",
  "location": "West US",
  "properties": {
    "provisioningState": "Updating",
    "osType": "Windows",
    "creationData": {
      "createOption": "FromImage",
      "imageReference": {
        "id": "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}"
      }
    }
  }
}

Create a managed disk from an existing managed disk in the same or different subscription.

Sample Request

PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk2?api-version=2019-03-01
{
  "location": "West US",
  "properties": {
    "creationData": {
      "createOption": "Copy",
      "sourceResourceId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1"
    }
  }
}

Sample Response

{
  "properties": {
    "creationData": {
      "createOption": "Copy",
      "sourceResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1"
    },
    "provisioningState": "Updating"
  },
  "location": "West US",
  "name": "myDisk2"
}
{
  "properties": {
    "creationData": {
      "createOption": "Copy",
      "sourceResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1"
    },
    "provisioningState": "Updating"
  },
  "location": "West US",
  "name": "myDisk2"
}

Create a managed upload disk.

Sample Request

PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2019-03-01
{
  "location": "West US",
  "properties": {
    "creationData": {
      "createOption": "Upload",
      "uploadSizeBytes": 10737418752
    }
  }
}

Sample Response

{
  "properties": {
    "creationData": {
      "createOption": "Upload",
      "uploadSizeBytes": 10737418752
    },
    "provisioningState": "Updating"
  },
  "location": "West US",
  "name": "myDisk"
}
{
  "properties": {
    "creationData": {
      "createOption": "Upload",
      "uploadSizeBytes": 10737418752
    },
    "provisioningState": "Updating"
  },
  "location": "West US",
  "name": "myDisk"
}

Create an empty managed disk.

Sample Request

PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2019-03-01
{
  "location": "West US",
  "properties": {
    "creationData": {
      "createOption": "Empty"
    },
    "diskSizeGB": 200
  }
}

Sample Response

{
  "properties": {
    "creationData": {
      "createOption": "Empty"
    },
    "diskSizeGB": 200,
    "provisioningState": "Updating"
  },
  "location": "West US",
  "name": "myDisk"
}
{
  "properties": {
    "creationData": {
      "createOption": "Empty"
    },
    "diskSizeGB": 200,
    "provisioningState": "Updating"
  },
  "location": "West US",
  "name": "myDisk"
}

Definitions

CreationData

Data used when creating a disk.

Disk

Disk resource.

DiskCreateOption

This enumerates the possible sources of a disk's creation.

DiskSku

The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS.

DiskState

The state of the disk.

DiskStorageAccountTypes

The sku name.

EncryptionSettingsCollection

Encryption settings for disk or snapshot

EncryptionSettingsElement

Encryption settings for one disk volume.

HyperVGeneration

The hypervisor generation of the Virtual Machine. Applicable to OS disks only.

ImageDiskReference

The source image used for creating the disk.

KeyVaultAndKeyReference

Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey

KeyVaultAndSecretReference

Key Vault Secret Url and vault id of the encryption key

OperatingSystemTypes

The Operating System type.

SourceVault

The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}

CreationData

Data used when creating a disk.

Name Type Description
createOption

This enumerates the possible sources of a disk's creation.

imageReference

Disk source information.

sourceResourceId
  • string

If createOption is Copy, this is the ARM id of the source snapshot or disk.

sourceUniqueId
  • string

If this field is set, this is the unique id identifying the source of this resource.

sourceUri
  • string

If createOption is Import, this is the URI of a blob to be imported into a managed disk.

storageAccountId
  • string

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

uploadSizeBytes
  • integer

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).

Disk

Disk resource.

Name Type Description
id
  • string

Resource Id

location
  • string

Resource location

managedBy
  • string

A relative URI containing the ID of the VM that has the disk attached.

name
  • string

Resource name

properties.creationData

Disk source information. CreationData information cannot be changed after the disk has been created.

properties.diskIOPSReadWrite
  • integer

The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes.

properties.diskMBpsReadWrite
  • integer

The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10.

properties.diskSizeBytes
  • integer

The size of the disk in bytes. This field is read only.

properties.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.

properties.diskState

The state of the disk.

properties.encryptionSettingsCollection

Encryption settings collection used for Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot.

properties.hyperVGeneration

The hypervisor generation of the Virtual Machine. Applicable to OS disks only.

properties.osType

The Operating System type.

properties.provisioningState
  • string

The disk provisioning state.

properties.timeCreated
  • string

The time when the disk was created.

properties.uniqueId
  • string

Unique Guid identifying the resource.

sku

The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS.

tags
  • object

Resource tags

type
  • string

Resource type

zones
  • string[]

The Logical zone list for Disk.

DiskCreateOption

This enumerates the possible sources of a disk's creation.

Name Type Description
Attach
  • string

Disk will be attached to a VM.

Copy
  • string

Create a new disk or snapshot by copying from a disk or snapshot specified by the given sourceResourceId.

Empty
  • string

Create an empty data disk of a size given by diskSizeGB.

FromImage
  • string

Create a new disk from a platform image specified by the given imageReference.

Import
  • string

Create a disk by importing from a blob specified by a sourceUri in a storage account specified by storageAccountId.

Restore
  • string

Create a new disk by copying from a backup recovery point.

Upload
  • string

Create a new disk by obtaining a write token and using it to directly upload the contents of the disk.

DiskSku

The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS.

Name Type Description
name

The sku name.

tier
  • string

The sku tier.

DiskState

The state of the disk.

Name Type Description
ActiveSAS
  • string

The disk currently has an Active SAS Uri associated with it.

ActiveUpload
  • string

A disk is created for upload and a write token has been issued for uploading to it.

Attached
  • string

The disk is currently mounted to a running VM.

ReadyToUpload
  • string

A disk is ready to be created by upload by requesting a write token.

Reserved
  • string

The disk is mounted to a stopped-deallocated VM

Unattached
  • string

The disk is not being used and can be attached to a VM.

DiskStorageAccountTypes

The sku name.

Name Type Description
Premium_LRS
  • string

Premium SSD locally redundant storage. Best for production and performance sensitive workloads.

StandardSSD_LRS
  • string

Standard SSD locally redundant storage. Best for web servers, lightly used enterprise applications and dev/test.

Standard_LRS
  • string

Standard HDD locally redundant storage. Best for backup, non-critical, and infrequent access.

UltraSSD_LRS
  • string

Ultra SSD locally redundant storage. Best for IO-intensive workloads such as SAP HANA, top tier databases (for example, SQL, Oracle), and other transaction-heavy workloads.

EncryptionSettingsCollection

Encryption settings for disk or snapshot

Name Type Description
enabled
  • boolean

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

A collection of encryption settings, one for each disk volume.

encryptionSettingsVersion
  • string

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.

EncryptionSettingsElement

Encryption settings for one disk volume.

Name Type Description
diskEncryptionKey

Key Vault Secret Url and vault id of the disk encryption key

keyEncryptionKey

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.

HyperVGeneration

The hypervisor generation of the Virtual Machine. Applicable to OS disks only.

Name Type Description
V1
  • string
V2
  • string

ImageDiskReference

The source image used for creating the disk.

Name Type Description
id
  • string

A relative uri containing either a Platform Image Repository or user image reference.

lun
  • integer

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.

KeyVaultAndKeyReference

Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey

Name Type Description
keyUrl
  • string

Url pointing to a key or secret in KeyVault

sourceVault

Resource id of the KeyVault containing the key or secret

KeyVaultAndSecretReference

Key Vault Secret Url and vault id of the encryption key

Name Type Description
secretUrl
  • string

Url pointing to a key or secret in KeyVault

sourceVault

Resource id of the KeyVault containing the key or secret

OperatingSystemTypes

The Operating System type.

Name Type Description
Linux
  • string
Windows
  • string

SourceVault

The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}

Name Type Description
id
  • string

Resource Id