Disks - Create Or Update

Create or replace an existing disk. This operation can take a while to complete.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}?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 disk.

resourceGroupName
path True

string

The name of the resource group.

subscriptionId
path True

string

The subscription ID.

userName
path True

string

The name of the user profile.

api-version
query True

string

Client API version.

Request Body

Name Type Description
location

string

The location of the resource.

properties.diskBlobName

string

When backed by a blob, the name of the VHD blob without extension.

properties.diskSizeGiB

integer

The size of the disk in Gibibytes.

properties.diskType

StorageType

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

properties.diskUri

string

When backed by a blob, the URI of underlying blob.

properties.hostCaching

string

The host caching policy of the disk (i.e. None, ReadOnly, ReadWrite).

properties.leasedByLabVmId

string

The resource ID of the VM to which this disk is leased.

properties.managedDiskId

string

When backed by managed disk, this is the ID of the compute disk resource.

properties.storageAccountId

string

When backed by a blob, the storage account where the blob is.

tags

object

The tags of the resource.

Responses

Name Type Description
200 OK

Disk

OK

201 Created

Disk

Created

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

Disks_CreateOrUpdate

Sample Request

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{labName}/users/{userId}/disks/{diskName}?api-version=2018-09-15

{
  "properties": {
    "diskType": "Standard",
    "diskSizeGiB": 1023,
    "leasedByLabVmId": "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualmachines/vmName"
  }
}

Sample Response

{
  "properties": {
    "diskType": "Standard",
    "diskSizeGiB": 1023,
    "leasedByLabVmId": "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualmachines/vmName",
    "diskUri": "",
    "createdDate": "2021-01-04T20:21:02.0182357+00:00",
    "hostCaching": "None",
    "provisioningState": "Succeeded",
    "uniqueIdentifier": "b7183ac5-1097-4513-b597-4d9d23e0a820"
  },
  "id": "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/l{labName}/users/{userId}/disks/{diskName}",
  "name": "{diskName}",
  "type": "Microsoft.DevTestLab/labs/users/disks"
}
{
  "properties": {
    "diskType": "Standard",
    "diskSizeGiB": 1023,
    "leasedByLabVmId": "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualmachines/vmName",
    "diskUri": "",
    "createdDate": "2021-01-04T20:21:02.0182357+00:00",
    "hostCaching": "None",
    "provisioningState": "Creating",
    "uniqueIdentifier": "b7183ac5-1097-4513-b597-4d9d23e0a820"
  },
  "id": "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/l{labName}/users/{userId}/disks/{diskName}",
  "name": "{diskName}",
  "type": "Microsoft.DevTestLab/labs/users/disks"
}

Definitions

Name Description
CloudError

Error from a REST request.

CloudErrorBody

Body of an error from a REST request.

Disk

A Disk.

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.

Disk

A Disk.

Name Type Description
id

string

The identifier of the resource.

location

string

The location of the resource.

name

string

The name of the resource.

properties.createdDate

string

The creation date of the disk.

properties.diskBlobName

string

When backed by a blob, the name of the VHD blob without extension.

properties.diskSizeGiB

integer

The size of the disk in Gibibytes.

properties.diskType

StorageType

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

properties.diskUri

string

When backed by a blob, the URI of underlying blob.

properties.hostCaching

string

The host caching policy of the disk (i.e. None, ReadOnly, ReadWrite).

properties.leasedByLabVmId

string

The resource ID of the VM to which this disk is leased.

properties.managedDiskId

string

When backed by managed disk, this is the ID of the compute disk resource.

properties.provisioningState

string

The provisioning status of the resource.

properties.storageAccountId

string

When backed by a blob, the storage account where the blob is.

properties.uniqueIdentifier

string

The unique immutable identifier of a resource (Guid).

tags

object

The tags of the resource.

type

string

The type of the resource.

StorageType

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

Name Type Description
Premium

string

Standard

string

StandardSSD

string