Virtual Machines - Add Data Disk

Attach a new or existing data disk to virtual machine. This operation can take a while to complete.

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk?api-version=2018-09-15

URI Parameters

Name In Required Type Description
labName
path True

string

The name of the lab.

name
path True

string

The name of the virtual machine.

resourceGroupName
path True

string

The name of the resource group.

subscriptionId
path True

string

The subscription ID.

api-version
query True

string

Client API version.

Request Body

Name Type Description
attachNewDataDiskOptions

AttachNewDataDiskOptions

Specifies options to attach a new disk to the virtual machine.

existingLabDiskId

string

Specifies the existing lab disk id to attach to virtual machine.

hostCaching

HostCachingOptions

Caching option for a data disk (i.e. None, ReadOnly, ReadWrite).

Responses

Name Type Description
200 OK

OK

202 Accepted

Accepted

Other Status Codes

CloudError

BadRequest

Security

azure_auth

OAuth2 Implicit Grant

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

Scopes

Name Description
user_impersonation Access Microsoft Azure

Examples

VirtualMachines_AddDataDisk

Sample Request

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/addDataDisk?api-version=2018-09-15

{
  "attachNewDataDiskOptions": {
    "diskSizeGiB": 127,
    "diskName": "{diskName}",
    "diskType": "{diskType}"
  }
}

Sample Response

location: https://management.azure.com/subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/Microsoft.DevTestLabs/locations/{location}

Definitions

Name Description
AttachNewDataDiskOptions

Properties to attach new disk to the Virtual Machine.

CloudError

Error from a REST request.

CloudErrorBody

Body of an error from a REST request.

DataDiskProperties

Request body for adding a new or existing data disk to a virtual machine.

HostCachingOptions

Caching option for a data disk (i.e. None, ReadOnly, ReadWrite).

StorageType

The storage type for the disk (i.e. Standard, Premium).

AttachNewDataDiskOptions

Properties to attach new disk to the Virtual Machine.

Name Type Description
diskName

string

The name of the disk to be attached.

diskSizeGiB

integer

Size of the disk to be attached in Gibibytes.

diskType

StorageType

The storage type for the disk (i.e. Standard, Premium).

CloudError

Error from a REST request.

Name Type Description
error

CloudErrorBody

The cloud error that occurred

CloudErrorBody

Body of an error from a REST request.

Name Type Description
code

string

The error code.

details

CloudErrorBody[]

Inner errors.

message

string

The error message.

target

string

The error target.

DataDiskProperties

Request body for adding a new or existing data disk to a virtual machine.

Name Type Description
attachNewDataDiskOptions

AttachNewDataDiskOptions

Specifies options to attach a new disk to the virtual machine.

existingLabDiskId

string

Specifies the existing lab disk id to attach to virtual machine.

hostCaching

HostCachingOptions

Caching option for a data disk (i.e. None, ReadOnly, ReadWrite).

HostCachingOptions

Caching option for a data disk (i.e. None, ReadOnly, ReadWrite).

Name Type Description
None

string

ReadOnly

string

ReadWrite

string

StorageType

The storage type for the disk (i.e. Standard, Premium).

Name Type Description
Premium

string

Standard

string

StandardSSD

string