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 |
---|---|---|---|---|
lab
|
path | True |
string |
The name of the lab. |
name
|
path | True |
string |
The name of the virtual machine. |
resource
|
path | True |
string |
The name of the resource group. |
subscription
|
path | True |
string |
The subscription ID. |
api-version
|
query | True |
string |
Client API version. |
Request Body
Name | Type | Description |
---|---|---|
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 |
Caching option for a data disk (i.e. None, ReadOnly, ReadWrite). |
Responses
Name | Type | Description |
---|---|---|
200 OK |
OK |
|
202 Accepted |
Accepted |
|
Other Status Codes |
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 |
---|---|
Attach |
Properties to attach new disk to the Virtual Machine. |
Cloud |
Error from a REST request. |
Cloud |
Body of an error from a REST request. |
Data |
Request body for adding a new or existing data disk to a virtual machine. |
Host |
Caching option for a data disk (i.e. None, ReadOnly, ReadWrite). |
Storage |
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 |
The storage type for the disk (i.e. Standard, Premium). |
CloudError
Error from a REST request.
Name | Type | Description |
---|---|---|
error |
The cloud error that occurred |
CloudErrorBody
Body of an error from a REST request.
Name | Type | Description |
---|---|---|
code |
string |
The error code. |
details |
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 |
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 |
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 |