Share via


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-11-01

URI Parameters

Name In Required Type Description
resourceGroupName
path True

string

minLength: 1
maxLength: 90

The name of the resource group. The name is case insensitive.

subscriptionId
path True

string

minLength: 1

The ID of the target subscription.

vmName
path True

string

The name of the virtual machine.

api-version
query True

string

minLength: 1

The API version to use for this operation.

Request Body

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.

Responses

Name Type Description
200 OK

StorageProfile

Azure operation completed successfully.

202 Accepted

Resource operation accepted.

Headers

  • Location: string
  • Retry-After: integer
Other Status Codes

CloudError

An unexpected error response.

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-11-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-11-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 API entity reference.

ApiError

Api error.

ApiErrorBase

Api error base.

AttachDetachDataDisksRequest

Specifies the input for attaching and detaching a list of managed data disks.

CachingTypes

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

CloudError

An error response from the Compute service.

DataDisk

Describes a data disk.

DataDisksToAttach

Describes the data disk to be attached.

DataDisksToDetach

Describes the data disk to be detached.

DiffDiskOptions

Specifies the ephemeral disk option for operating system disk.

DiffDiskPlacement

Specifies the ephemeral disk placement for operating system disk. This property can be used by user in the request to choose the location i.e, cache disk, resource disk or nvme disk space for Ephemeral OS disk provisioning. For more information on Ephemeral OS disk size requirements, please refer Ephemeral OS disk size requirements for Windows VM at https://docs.microsoft.com/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements and Linux VM at https://docs.microsoft.com/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements. Minimum api-version for NvmeDisk: 2024-03-01.

DiffDiskSettings

Describes the parameters of ephemeral disk settings that can be specified for operating system disk. Note: The ephemeral disk settings can only be specified for managed disk.

DiskControllerTypes

Specifies the disk controller type configured for the VM and VirtualMachineScaleSet. This property is only supported for virtual machines whose operating system disk and VM sku supports Generation 2 (https://docs.microsoft.com/en-us/azure/virtual-machines/generation-2), please check the HyperVGenerations capability returned as part of VM sku capabilities in the response of Microsoft.Compute SKUs api for the region contains V2 (https://docs.microsoft.com/rest/api/compute/resourceskus/list). For more information about Disk Controller Types supported please refer to https://aka.ms/azure-diskcontrollertypes.

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

DiskDeleteOptionTypes

Specifies the behavior of the managed disk when the VM gets deleted, for example whether the managed disk is deleted or detached. Supported values are: Delete. If this value is used, the managed disk is deleted when VM gets deleted. Detach. If this value is used, the managed disk is retained after VM gets deleted. Minimum api-version: 2021-03-01.

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 are: 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. To force-detach a data disk update toBeDetached to 'true' along with setting detachOption: 'ForceDetach'.

DiskEncryptionSetParameters

Describes the parameter of customer managed disk encryption set resource id that can be specified for disk. Note: The disk encryption set resource id can only be specified for managed disk. Please refer https://aka.ms/mdssewithcmkoverview for more details.

DiskEncryptionSettings

Describes a Encryption Settings for a Disk

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. NOTE: Image reference publisher and offer can only be set when you create the scale set.

InnerError

Inner error details.

KeyVaultKeyReference

Describes a reference to Key Vault Key

KeyVaultSecretReference

Describes a reference to Key Vault Secret

ManagedDiskParameters

The parameters of a managed disk.

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.

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. Managed OS disk storage account type can only be set when you create the scale set. NOTE: UltraSSD_LRS can only be used with data disks. It cannot be used with OS Disk. Standard_LRS uses Standard HDD. StandardSSD_LRS uses Standard SSD. Premium_LRS uses Premium SSD. UltraSSD_LRS uses Ultra disk. Premium_ZRS uses Premium SSD zone redundant storage. StandardSSD_ZRS uses Standard SSD zone redundant storage. For more information regarding disks supported for Windows Virtual Machines, refer to https://docs.microsoft.com/azure/virtual-machines/windows/disks-types and, for Linux Virtual Machines, refer to https://docs.microsoft.com/azure/virtual-machines/linux/disks-types

StorageProfile

Specifies the storage settings for the virtual machine disks.

SubResource
VirtualHardDisk

Describes the uri of a disk.

VMDiskSecurityProfile

Specifies the security profile settings for the managed disk. Note: It can only be set for Confidential VMs.

ApiEntityReference

The API entity reference.

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

Specifies the input for attaching and detaching a list of managed data disks.

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 default values are: None for Standard storage. ReadOnly for Premium storage

Value Description
None
ReadOnly
ReadWrite

CloudError

An error response from the Compute service.

Name Type Description
error

ApiError

Api error.

DataDisk

Describes a data disk.

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. To force-detach a data disk update toBeDetached to 'true' along with setting detachOption: 'ForceDetach'.

diskIOPSReadWrite

integer (int64)

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 (int64)

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 (int32)

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 (int32)

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

Describes the data disk 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 (int32)

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

Describes the data disk 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 option for operating system disk.

Value Description
Local

DiffDiskPlacement

Specifies the ephemeral disk placement for operating system disk. This property can be used by user in the request to choose the location i.e, cache disk, resource disk or nvme disk space for Ephemeral OS disk provisioning. For more information on Ephemeral OS disk size requirements, please refer Ephemeral OS disk size requirements for Windows VM at https://docs.microsoft.com/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements and Linux VM at https://docs.microsoft.com/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements. Minimum api-version for NvmeDisk: 2024-03-01.

Value Description
CacheDisk
ResourceDisk
NvmeDisk

DiffDiskSettings

Describes the parameters of ephemeral disk settings that can be specified for operating system disk. Note: The ephemeral disk settings can only be specified for managed disk.

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 and VirtualMachineScaleSet. This property is only supported for virtual machines whose operating system disk and VM sku supports Generation 2 (https://docs.microsoft.com/en-us/azure/virtual-machines/generation-2), please check the HyperVGenerations capability returned as part of VM sku capabilities in the response of Microsoft.Compute SKUs api for the region contains V2 (https://docs.microsoft.com/rest/api/compute/resourceskus/list). For more information about Disk Controller Types supported please refer to https://aka.ms/azure-diskcontrollertypes.

Value Description
SCSI
NVMe

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

Value Description
FromImage
Empty
Attach
Copy
Restore

DiskDeleteOptionTypes

Specifies the behavior of the managed disk when the VM gets deleted, for example whether the managed disk is deleted or detached. Supported values are: Delete. If this value is used, the managed disk is deleted when VM gets deleted. Detach. If this value is used, the managed disk is retained after VM gets deleted. Minimum api-version: 2021-03-01.

Value Description
Delete
Detach

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 are: 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. To force-detach a data disk update toBeDetached to 'true' along with setting detachOption: 'ForceDetach'.

Value Description
ForceDetach

DiskEncryptionSetParameters

Describes the parameter of customer managed disk encryption set resource id that can be specified for disk. Note: The disk encryption set resource id can only be specified for managed disk. Please refer https://aka.ms/mdssewithcmkoverview for more details.

Name Type Description
id

string

Resource Id

DiskEncryptionSettings

Describes a Encryption Settings for a Disk

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. NOTE: Image reference publisher and offer can only be set when you create the scale set.

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

Describes a reference to Key Vault Key

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

Describes a reference to 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 parameters of a managed disk.

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

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.

Value Description
Windows
Linux

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 (int32)

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.

Value Description
VMGuestStateOnly
DiskWithVMGuestState
NonPersistedTPM

StorageAccountTypes

Specifies the storage account type for the managed disk. Managed OS disk storage account type can only be set when you create the scale set. NOTE: UltraSSD_LRS can only be used with data disks. It cannot be used with OS Disk. Standard_LRS uses Standard HDD. StandardSSD_LRS uses Standard SSD. Premium_LRS uses Premium SSD. UltraSSD_LRS uses Ultra disk. Premium_ZRS uses Premium SSD zone redundant storage. StandardSSD_ZRS uses Standard SSD zone redundant storage. For more information regarding disks supported for Windows Virtual Machines, refer to https://docs.microsoft.com/azure/virtual-machines/windows/disks-types and, for Linux Virtual Machines, refer to https://docs.microsoft.com/azure/virtual-machines/linux/disks-types

Value Description
Standard_LRS
Premium_LRS
StandardSSD_LRS
UltraSSD_LRS
Premium_ZRS
StandardSSD_ZRS
PremiumV2_LRS

StorageProfile

Specifies the storage settings for the virtual machine disks.

Name Type Description
alignRegionalDisksToVMZone

boolean

Specifies whether the regional disks should be aligned/moved to the VM zone. This is applicable only for VMs with placement property set. Please note that this change is irreversible. Minimum api-version: 2024-11-01.

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

Describes the uri of a disk.

Name Type Description
uri

string

Specifies the virtual hard disk's uri.

VMDiskSecurityProfile

Specifies the security profile settings for the managed disk. Note: It can only be set for Confidential VMs.

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.