Virtual Machines - Attach Detach Data Disks

Attach and detach data disks to/from the virtual machine.

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/attachDetachDataDisks?api-version=2024-03-01

URI Parameters

Name In Required Type Description
resourceGroupName
path True

string

The name of the resource group.

subscriptionId
path True

string

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

vmName
path True

string

The name of the virtual machine.

api-version
query True

string

Client Api Version.

Request Body

Name Type Description
parameters

AttachDetachDataDisksRequest

Parameters supplied to the attach and detach data disks operation on the virtual machine.

Responses

Name Type Description
200 OK

StorageProfile

OK

202 Accepted

Accepted

Headers

Location: string

Other Status Codes

CloudError

Error response describing why the operation failed.

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

VirtualMachine_AttachDetachDataDisks_MaximumSet_Gen
VirtualMachine_AttachDetachDataDisks_MinimumSet_Gen

VirtualMachine_AttachDetachDataDisks_MaximumSet_Gen

Sample request

POST https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachines/aaaaaaaaaaaaaaaaaaaa/attachDetachDataDisks?api-version=2024-03-01

{
  "dataDisksToAttach": [
    {
      "lun": 1,
      "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d",
      "diskEncryptionSet": {
        "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"
      },
      "caching": "ReadOnly",
      "deleteOption": "Delete",
      "writeAcceleratorEnabled": true
    },
    {
      "lun": 2,
      "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_2_disk3_7d5e664bdafa49baa780eb2d128ff38e",
      "diskEncryptionSet": {
        "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"
      },
      "caching": "ReadWrite",
      "deleteOption": "Detach",
      "writeAcceleratorEnabled": false
    }
  ],
  "dataDisksToDetach": [
    {
      "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_1_disk1_1a4e784bdafa49baa780eb2d128ff65x",
      "detachOption": "ForceDetach"
    },
    {
      "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_4_disk4_4d4e784bdafa49baa780eb2d256ff41z",
      "detachOption": "ForceDetach"
    }
  ]
}

Sample response

location: https://foo.com/operationstatus
{
  "imageReference": {
    "publisher": "MicrosoftWindowsServer",
    "offer": "WindowsServer",
    "sku": "2016-Datacenter",
    "version": "latest"
  },
  "osDisk": {
    "osType": "Windows",
    "name": "myOsDisk",
    "createOption": "FromImage",
    "caching": "ReadWrite",
    "managedDisk": {
      "storageAccountType": "Premium_LRS",
      "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myOsDisk"
    },
    "diskSizeGB": 30
  },
  "dataDisks": [
    {
      "lun": 1,
      "name": "vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d",
      "createOption": "Attach",
      "caching": "ReadOnly",
      "managedDisk": {
        "storageAccountType": "Premium_LRS",
        "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d",
        "diskEncryptionSet": {
          "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"
        }
      },
      "deleteOption": "Delete",
      "diskSizeGB": 30,
      "writeAcceleratorEnabled": true
    },
    {
      "lun": 2,
      "name": "vmss3176_vmss3176_2_disk3_7d5e664bdafa49baa780eb2d128ff38e",
      "createOption": "Attach",
      "caching": "ReadWrite",
      "managedDisk": {
        "storageAccountType": "Premium_LRS",
        "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_2_disk3_7d5e664bdafa49baa780eb2d128ff38e",
        "diskEncryptionSet": {
          "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"
        }
      },
      "deleteOption": "Detach",
      "diskSizeGB": 100,
      "writeAcceleratorEnabled": false
    }
  ]
}
location: https://foo.com/operationstatus

VirtualMachine_AttachDetachDataDisks_MinimumSet_Gen

Sample request

POST https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachines/azure-vm/attachDetachDataDisks?api-version=2024-03-01

{
  "dataDisksToAttach": [
    {
      "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"
    }
  ],
  "dataDisksToDetach": [
    {
      "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_1_disk1_1a4e784bdafa49baa780eb2d128ff65x"
    }
  ]
}

Sample response

location: https://foo.com/operationstatus
{
  "imageReference": {
    "publisher": "MicrosoftWindowsServer",
    "offer": "WindowsServer",
    "sku": "2016-Datacenter",
    "version": "latest"
  },
  "osDisk": {
    "osType": "Windows",
    "name": "myOsDisk",
    "createOption": "FromImage",
    "caching": "ReadWrite",
    "managedDisk": {
      "storageAccountType": "Premium_LRS",
      "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myOsDisk"
    },
    "diskSizeGB": 30
  },
  "dataDisks": [
    {
      "lun": 0,
      "name": "vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d",
      "createOption": "Attach",
      "caching": "ReadWrite",
      "managedDisk": {
        "storageAccountType": "Premium_LRS",
        "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"
      },
      "diskSizeGB": 30
    }
  ]
}
location: https://foo.com/operationstatus

Definitions

Name Description
ApiEntityReference

The source resource identifier. It can be a snapshot, or disk restore point from which to create a disk.

ApiError

Api error.

ApiErrorBase

Api error base.

AttachDetachDataDisksRequest

Parameters supplied to the attach and detach data disks operation on the virtual machine.

CachingTypes

Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The defaulting behavior is: None for Standard storage. ReadOnly for Premium storage.

CloudError

An error response from the Compute service.

DataDisk

Specifies the parameters that are used to add a data disk to a virtual machine. For more information about disks, see About disks and VHDs for Azure virtual machines.

DataDisksToAttach

The list of managed data disks to be attached.

DataDisksToDetach

The list of managed data disks to be detached.

DiffDiskOptions

Specifies the ephemeral disk settings for operating system disk.

DiffDiskPlacement

Specifies the ephemeral disk placement for operating system disk. Possible values are: CacheDisk, ResourceDisk, NvmeDisk. The defaulting behavior is: CacheDisk if one is configured for the VM size otherwise ResourceDisk or NvmeDisk is used. Refer to the VM size documentation for Windows VM at https://docs.microsoft.com/azure/virtual-machines/windows/sizes and Linux VM at https://docs.microsoft.com/azure/virtual-machines/linux/sizes to check which VM sizes exposes a cache disk. Minimum api-version for NvmeDisk: 2024-03-01.

DiffDiskSettings

Specifies the ephemeral Disk Settings for the operating system disk used by the virtual machine.

DiskControllerTypes

Specifies the disk controller type configured for the VM. Note: This property will be set to the default disk controller type if not specified provided virtual machine is being created with 'hyperVGeneration' set to V2 based on the capabilities of the operating system disk and VM size from the the specified minimum api version. You need to deallocate the VM before updating its disk controller type unless you are updating the VM size in the VM configuration which implicitly deallocates and reallocates the VM. Minimum api-version: 2022-08-01.

DiskCreateOptionTypes

Specifies how the virtual machine disk should be created. Possible values are Attach: This value is used when you are using a specialized disk to create the virtual machine. FromImage: This value is used when you are using an image to create the virtual machine. If you are using a platform image, you should also use the imageReference element described above. If you are using a marketplace image, you should also use the plan element previously described.

DiskDeleteOptionTypes

Specifies whether OS Disk should be deleted or detached upon VM deletion. Possible values are: Delete. If this value is used, the OS disk is deleted when VM is deleted. Detach. If this value is used, the os disk is retained after VM is deleted. The default value is set to Detach. For an ephemeral OS Disk, the default value is set to Delete. The user cannot change the delete option for an ephemeral OS Disk.

DiskDetachOptionTypes

Specifies the detach behavior to be used while detaching a disk or which is already in the process of detachment from the virtual machine. Supported values: ForceDetach. detachOption: ForceDetach is applicable only for managed data disks. If a previous detachment attempt of the data disk did not complete due to an unexpected failure from the virtual machine and the disk is still not released then use force-detach as a last resort option to detach the disk forcibly from the VM. All writes might not have been flushed when using this detach behavior. This feature is still in preview mode and is not supported for VirtualMachineScaleSet. To force-detach a data disk update toBeDetached to 'true' along with setting detachOption: 'ForceDetach'.

DiskEncryptionSetParameters

Specifies the customer managed disk encryption set resource id for the managed disk.

DiskEncryptionSettings

Specifies the encryption settings for the OS Disk. Minimum api-version: 2015-06-15.

ImageReference

Specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations.

InnerError

Inner error details.

KeyVaultKeyReference

Specifies the location of the key encryption key in Key Vault.

KeyVaultSecretReference

Specifies the location of the disk encryption key, which is a Key Vault Secret.

ManagedDiskParameters

The managed disk parameters.

OperatingSystemTypes

The Operating System type.

OSDisk

Specifies information about the operating system disk used by the virtual machine. For more information about disks, see About disks and VHDs for Azure virtual machines.

securityEncryptionTypes

Specifies the EncryptionType of the managed disk. It is set to DiskWithVMGuestState for encryption of the managed disk along with VMGuestState blob, VMGuestStateOnly for encryption of just the VMGuestState blob, and NonPersistedTPM for not persisting firmware state in the VMGuestState blob.. Note: It can be set for only Confidential VMs.

StorageAccountTypes

Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk.

StorageProfile

Specifies the storage settings for the virtual machine disks.

SubResource
VirtualHardDisk

The virtual hard disk.

VMDiskSecurityProfile

Specifies the security profile for the managed disk.

ApiEntityReference

The source resource identifier. It can be a snapshot, or disk restore point from which to create a disk.

Name Type Description
id

string

The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/...

ApiError

Api error.

Name Type Description
code

string

The error code.

details

ApiErrorBase[]

The Api error details

innererror

InnerError

The Api inner error

message

string

The error message.

target

string

The target of the particular error.

ApiErrorBase

Api error base.

Name Type Description
code

string

The error code.

message

string

The error message.

target

string

The target of the particular error.

AttachDetachDataDisksRequest

Parameters supplied to the attach and detach data disks operation on the virtual machine.

Name Type Description
dataDisksToAttach

DataDisksToAttach[]

The list of managed data disks to be attached.

dataDisksToDetach

DataDisksToDetach[]

The list of managed data disks to be detached.

CachingTypes

Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The defaulting behavior is: None for Standard storage. ReadOnly for Premium storage.

Name Type Description
None

string

ReadOnly

string

ReadWrite

string

CloudError

An error response from the Compute service.

Name Type Description
error

ApiError

Api error.

DataDisk

Specifies the parameters that are used to add a data disk to a virtual machine. For more information about disks, see About disks and VHDs for Azure virtual machines.

Name Type Description
caching

CachingTypes

Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The defaulting behavior is: None for Standard storage. ReadOnly for Premium storage.

createOption

DiskCreateOptionTypes

Specifies how the virtual machine disk should be created. Possible values are Attach: This value is used when you are using a specialized disk to create the virtual machine. FromImage: This value is used when you are using an image to create the virtual machine data disk. If you are using a platform image, you should also use the imageReference element described above. If you are using a marketplace image, you should also use the plan element previously described. Empty: This value is used when creating an empty data disk. Copy: This value is used to create a data disk from a snapshot or another disk. Restore: This value is used to create a data disk from a disk restore point.

deleteOption

DiskDeleteOptionTypes

Specifies whether data disk should be deleted or detached upon VM deletion. Possible values are: Delete. If this value is used, the data disk is deleted when VM is deleted. Detach. If this value is used, the data disk is retained after VM is deleted. The default value is set to Detach.

detachOption

DiskDetachOptionTypes

Specifies the detach behavior to be used while detaching a disk or which is already in the process of detachment from the virtual machine. Supported values: ForceDetach. detachOption: ForceDetach is applicable only for managed data disks. If a previous detachment attempt of the data disk did not complete due to an unexpected failure from the virtual machine and the disk is still not released then use force-detach as a last resort option to detach the disk forcibly from the VM. All writes might not have been flushed when using this detach behavior. This feature is still in preview mode and is not supported for VirtualMachineScaleSet. To force-detach a data disk update toBeDetached to 'true' along with setting detachOption: 'ForceDetach'.

diskIOPSReadWrite

integer

Specifies the Read-Write IOPS for the managed disk when StorageAccountType is UltraSSD_LRS. Returned only for VirtualMachine ScaleSet VM disks. Can be updated only via updates to the VirtualMachine Scale Set.

diskMBpsReadWrite

integer

Specifies the bandwidth in MB per second for the managed disk when StorageAccountType is UltraSSD_LRS. Returned only for VirtualMachine ScaleSet VM disks. Can be updated only via updates to the VirtualMachine Scale Set.

diskSizeGB

integer

Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image. The property 'diskSizeGB' is the number of bytes x 1024^3 for the disk and the value cannot be larger than 1023.

image

VirtualHardDisk

The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist.

lun

integer

Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM.

managedDisk

ManagedDiskParameters

The managed disk parameters.

name

string

The disk name.

sourceResource

ApiEntityReference

The source resource identifier. It can be a snapshot, or disk restore point from which to create a disk.

toBeDetached

boolean

Specifies whether the data disk is in process of detachment from the VirtualMachine/VirtualMachineScaleset

vhd

VirtualHardDisk

The virtual hard disk.

writeAcceleratorEnabled

boolean

Specifies whether writeAccelerator should be enabled or disabled on the disk.

DataDisksToAttach

The list of managed data disks to be attached.

Name Type Description
caching

CachingTypes

Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The defaulting behavior is: None for Standard storage. ReadOnly for Premium storage.

deleteOption

DiskDeleteOptionTypes

Specifies whether data disk should be deleted or detached upon VM deletion. Possible values are: Delete. If this value is used, the data disk is deleted when VM is deleted. Detach. If this value is used, the data disk is retained after VM is deleted. The default value is set to Detach.

diskEncryptionSet

DiskEncryptionSetParameters

Specifies the customer managed disk encryption set resource id for the managed disk.

diskId

string

ID of the managed data disk.

lun

integer

The logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. If not specified, lun would be auto assigned.

writeAcceleratorEnabled

boolean

Specifies whether writeAccelerator should be enabled or disabled on the disk.

DataDisksToDetach

The list of managed data disks to be detached.

Name Type Description
detachOption

DiskDetachOptionTypes

Supported options available for Detach of a disk from a VM. Refer to DetachOption object reference for more details.

diskId

string

ID of the managed data disk.

DiffDiskOptions

Specifies the ephemeral disk settings for operating system disk.

Name Type Description
Local

string

DiffDiskPlacement

Specifies the ephemeral disk placement for operating system disk. Possible values are: CacheDisk, ResourceDisk, NvmeDisk. The defaulting behavior is: CacheDisk if one is configured for the VM size otherwise ResourceDisk or NvmeDisk is used. Refer to the VM size documentation for Windows VM at https://docs.microsoft.com/azure/virtual-machines/windows/sizes and Linux VM at https://docs.microsoft.com/azure/virtual-machines/linux/sizes to check which VM sizes exposes a cache disk. Minimum api-version for NvmeDisk: 2024-03-01.

Name Type Description
CacheDisk

string

NvmeDisk

string

ResourceDisk

string

DiffDiskSettings

Specifies the ephemeral Disk Settings for the operating system disk used by the virtual machine.

Name Type Description
option

DiffDiskOptions

Specifies the ephemeral disk settings for operating system disk.

placement

DiffDiskPlacement

Specifies the ephemeral disk placement for operating system disk. Possible values are: CacheDisk, ResourceDisk, NvmeDisk. The defaulting behavior is: CacheDisk if one is configured for the VM size otherwise ResourceDisk or NvmeDisk is used. Refer to the VM size documentation for Windows VM at https://docs.microsoft.com/azure/virtual-machines/windows/sizes and Linux VM at https://docs.microsoft.com/azure/virtual-machines/linux/sizes to check which VM sizes exposes a cache disk. Minimum api-version for NvmeDisk: 2024-03-01.

DiskControllerTypes

Specifies the disk controller type configured for the VM. Note: This property will be set to the default disk controller type if not specified provided virtual machine is being created with 'hyperVGeneration' set to V2 based on the capabilities of the operating system disk and VM size from the the specified minimum api version. You need to deallocate the VM before updating its disk controller type unless you are updating the VM size in the VM configuration which implicitly deallocates and reallocates the VM. Minimum api-version: 2022-08-01.

Name Type Description
NVMe

string

SCSI

string

DiskCreateOptionTypes

Specifies how the virtual machine disk should be created. Possible values are Attach: This value is used when you are using a specialized disk to create the virtual machine. FromImage: This value is used when you are using an image to create the virtual machine. If you are using a platform image, you should also use the imageReference element described above. If you are using a marketplace image, you should also use the plan element previously described.

Name Type Description
Attach

string

Copy

string

Empty

string

FromImage

string

Restore

string

DiskDeleteOptionTypes

Specifies whether OS Disk should be deleted or detached upon VM deletion. Possible values are: Delete. If this value is used, the OS disk is deleted when VM is deleted. Detach. If this value is used, the os disk is retained after VM is deleted. The default value is set to Detach. For an ephemeral OS Disk, the default value is set to Delete. The user cannot change the delete option for an ephemeral OS Disk.

Name Type Description
Delete

string

Detach

string

DiskDetachOptionTypes

Specifies the detach behavior to be used while detaching a disk or which is already in the process of detachment from the virtual machine. Supported values: ForceDetach. detachOption: ForceDetach is applicable only for managed data disks. If a previous detachment attempt of the data disk did not complete due to an unexpected failure from the virtual machine and the disk is still not released then use force-detach as a last resort option to detach the disk forcibly from the VM. All writes might not have been flushed when using this detach behavior. This feature is still in preview mode and is not supported for VirtualMachineScaleSet. To force-detach a data disk update toBeDetached to 'true' along with setting detachOption: 'ForceDetach'.

Name Type Description
ForceDetach

string

DiskEncryptionSetParameters

Specifies the customer managed disk encryption set resource id for the managed disk.

Name Type Description
id

string

Resource Id

DiskEncryptionSettings

Specifies the encryption settings for the OS Disk. Minimum api-version: 2015-06-15.

Name Type Description
diskEncryptionKey

KeyVaultSecretReference

Specifies the location of the disk encryption key, which is a Key Vault Secret.

enabled

boolean

Specifies whether disk encryption should be enabled on the virtual machine.

keyEncryptionKey

KeyVaultKeyReference

Specifies the location of the key encryption key in Key Vault.

ImageReference

Specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations.

Name Type Description
communityGalleryImageId

string

Specified the community gallery image unique id for vm deployment. This can be fetched from community gallery image GET call.

exactVersion

string

Specifies in decimal numbers, the version of platform image or marketplace image used to create the virtual machine. This readonly field differs from 'version', only if the value specified in 'version' field is 'latest'.

id

string

Resource Id

offer

string

Specifies the offer of the platform image or marketplace image used to create the virtual machine.

publisher

string

The image publisher.

sharedGalleryImageId

string

Specified the shared gallery image unique id for vm deployment. This can be fetched from shared gallery image GET call.

sku

string

The image SKU.

version

string

Specifies the version of the platform image or marketplace image used to create the virtual machine. The allowed formats are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. Specify 'latest' to use the latest version of an image available at deploy time. Even if you use 'latest', the VM image will not automatically update after deploy time even if a new version becomes available. Please do not use field 'version' for gallery image deployment, gallery image should always use 'id' field for deployment, to use 'latest' version of gallery image, just set '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}' in the 'id' field without version input.

InnerError

Inner error details.

Name Type Description
errordetail

string

The internal error message or exception dump.

exceptiontype

string

The exception type.

KeyVaultKeyReference

Specifies the location of the key encryption key in Key Vault.

Name Type Description
keyUrl

string

The URL referencing a key encryption key in Key Vault.

sourceVault

SubResource

The relative URL of the Key Vault containing the key.

KeyVaultSecretReference

Specifies the location of the disk encryption key, which is a Key Vault Secret.

Name Type Description
secretUrl

string

The URL referencing a secret in a Key Vault.

sourceVault

SubResource

The relative URL of the Key Vault containing the secret.

ManagedDiskParameters

The managed disk parameters.

Name Type Description
diskEncryptionSet

DiskEncryptionSetParameters

Specifies the customer managed disk encryption set resource id for the managed disk.

id

string

Resource Id

securityProfile

VMDiskSecurityProfile

Specifies the security profile for the managed disk.

storageAccountType

StorageAccountTypes

Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk.

OperatingSystemTypes

The Operating System type.

Name Type Description
Linux

string

Windows

string

OSDisk

Specifies information about the operating system disk used by the virtual machine. For more information about disks, see About disks and VHDs for Azure virtual machines.

Name Type Description
caching

CachingTypes

Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The defaulting behavior is: None for Standard storage. ReadOnly for Premium storage.

createOption

DiskCreateOptionTypes

Specifies how the virtual machine disk should be created. Possible values are Attach: This value is used when you are using a specialized disk to create the virtual machine. FromImage: This value is used when you are using an image to create the virtual machine. If you are using a platform image, you should also use the imageReference element described above. If you are using a marketplace image, you should also use the plan element previously described.

deleteOption

DiskDeleteOptionTypes

Specifies whether OS Disk should be deleted or detached upon VM deletion. Possible values are: Delete. If this value is used, the OS disk is deleted when VM is deleted. Detach. If this value is used, the os disk is retained after VM is deleted. The default value is set to Detach. For an ephemeral OS Disk, the default value is set to Delete. The user cannot change the delete option for an ephemeral OS Disk.

diffDiskSettings

DiffDiskSettings

Specifies the ephemeral Disk Settings for the operating system disk used by the virtual machine.

diskSizeGB

integer

Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image. The property 'diskSizeGB' is the number of bytes x 1024^3 for the disk and the value cannot be larger than 1023.

encryptionSettings

DiskEncryptionSettings

Specifies the encryption settings for the OS Disk. Minimum api-version: 2015-06-15.

image

VirtualHardDisk

The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist.

managedDisk

ManagedDiskParameters

The managed disk parameters.

name

string

The disk name.

osType

OperatingSystemTypes

This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD. Possible values are: Windows, Linux.

vhd

VirtualHardDisk

The virtual hard disk.

writeAcceleratorEnabled

boolean

Specifies whether writeAccelerator should be enabled or disabled on the disk.

securityEncryptionTypes

Specifies the EncryptionType of the managed disk. It is set to DiskWithVMGuestState for encryption of the managed disk along with VMGuestState blob, VMGuestStateOnly for encryption of just the VMGuestState blob, and NonPersistedTPM for not persisting firmware state in the VMGuestState blob.. Note: It can be set for only Confidential VMs.

Name Type Description
DiskWithVMGuestState

string

NonPersistedTPM

string

VMGuestStateOnly

string

StorageAccountTypes

Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk.

Name Type Description
PremiumV2_LRS

string

Premium_LRS

string

Premium_ZRS

string

StandardSSD_LRS

string

StandardSSD_ZRS

string

Standard_LRS

string

UltraSSD_LRS

string

StorageProfile

Specifies the storage settings for the virtual machine disks.

Name Type Description
dataDisks

DataDisk[]

Specifies the parameters that are used to add a data disk to a virtual machine. For more information about disks, see About disks and VHDs for Azure virtual machines.

diskControllerType

DiskControllerTypes

Specifies the disk controller type configured for the VM. Note: This property will be set to the default disk controller type if not specified provided virtual machine is being created with 'hyperVGeneration' set to V2 based on the capabilities of the operating system disk and VM size from the the specified minimum api version. You need to deallocate the VM before updating its disk controller type unless you are updating the VM size in the VM configuration which implicitly deallocates and reallocates the VM. Minimum api-version: 2022-08-01.

imageReference

ImageReference

Specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations.

osDisk

OSDisk

Specifies information about the operating system disk used by the virtual machine. For more information about disks, see About disks and VHDs for Azure virtual machines.

SubResource

Name Type Description
id

string

Resource Id

VirtualHardDisk

The virtual hard disk.

Name Type Description
uri

string

Specifies the virtual hard disk's uri.

VMDiskSecurityProfile

Specifies the security profile for the managed disk.

Name Type Description
diskEncryptionSet

DiskEncryptionSetParameters

Specifies the customer managed disk encryption set resource id for the managed disk that is used for Customer Managed Key encrypted ConfidentialVM OS Disk and VMGuest blob.

securityEncryptionType

securityEncryptionTypes

Specifies the EncryptionType of the managed disk. It is set to DiskWithVMGuestState for encryption of the managed disk along with VMGuestState blob, VMGuestStateOnly for encryption of just the VMGuestState blob, and NonPersistedTPM for not persisting firmware state in the VMGuestState blob.. Note: It can be set for only Confidential VMs.