Share via


VirtualMachineDiskOperationsExtensions.CreateDataDisk Method

The Create Data Disk operation adds a data disk to a virtual machine. There are three ways to create the data disk using the Add Data Disk operation. Option 1 - Attach an empty data disk to the role by specifying the disk label and location of the disk image. Do not include the DiskName and SourceMediaLink elements in the request body. Include the MediaLink element and reference a blob that is in the same geographical region as the role. You can also omit the MediaLink element. In this usage, Azure will create the data disk in the storage account configured as default for the role. Option 2 - Attach an existing data disk that is in the image repository. Do not include the DiskName and SourceMediaLink elements in the request body. Specify the data disk to use by including the DiskName element. Note: If included the in the response body, the MediaLink and LogicalDiskSizeInGB elements are ignored. Option 3 - Specify the location of a blob in your storage account that contain a disk image to use. Include the SourceMediaLink element. Note: If the MediaLink element isincluded, it is ignored. (see https://msdn.microsoft.com/library/windowsazure/jj157199.aspx for more information)

Namespace: Microsoft.WindowsAzure.Management.Compute
Assembly: Microsoft.WindowsAzure.Management.Compute (in Microsoft.WindowsAzure.Management.Compute.dll)

Usage

'Usage
Dim operations As IVirtualMachineDiskOperations
Dim serviceName As String
Dim deploymentName As String
Dim roleName As String
Dim parameters As VirtualMachineDataDiskCreateParameters
Dim returnValue As OperationStatusResponse

returnValue = VirtualMachineDiskOperationsExtensions.CreateDataDisk(operations, serviceName, deploymentName, roleName, parameters)

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function CreateDataDisk ( _
    operations As IVirtualMachineDiskOperations, _
    serviceName As String, _
    deploymentName As String, _
    roleName As String, _
    parameters As VirtualMachineDataDiskCreateParameters _
) As OperationStatusResponse
[ExtensionAttribute] 
public static OperationStatusResponse CreateDataDisk (
    IVirtualMachineDiskOperations operations,
    string serviceName,
    string deploymentName,
    string roleName,
    VirtualMachineDataDiskCreateParameters parameters
)
[ExtensionAttribute] 
public:
static OperationStatusResponse^ CreateDataDisk (
    IVirtualMachineDiskOperations^ operations, 
    String^ serviceName, 
    String^ deploymentName, 
    String^ roleName, 
    VirtualMachineDataDiskCreateParameters^ parameters
)
/** @attribute ExtensionAttribute() */ 
public static OperationStatusResponse CreateDataDisk (
    IVirtualMachineDiskOperations operations, 
    String serviceName, 
    String deploymentName, 
    String roleName, 
    VirtualMachineDataDiskCreateParameters parameters
)
ExtensionAttribute 
public static function CreateDataDisk (
    operations : IVirtualMachineDiskOperations, 
    serviceName : String, 
    deploymentName : String, 
    roleName : String, 
    parameters : VirtualMachineDataDiskCreateParameters
) : OperationStatusResponse

Parameters

  • operations
    Reference to the Microsoft.WindowsAzure.Management.Compute.IVirtualMachineDiskOperations.
  • serviceName
    Required. The name of your service.
  • deploymentName
    Required. The name of the deployment.
  • roleName
    Required. The name of the role to add the data disk to.
  • parameters
    Required. Parameters supplied to the Create Virtual Machine Data Disk operation.

Return Value

The response body contains the status of the specified asynchronous operation, indicating whether it has succeeded, is inprogress, or has failed. Note that this status is distinct from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response body includes the HTTP status code for the successful request. If the asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information regarding the failure.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows Vista, Windows 7, Windows Server 2008, Windows 8.1, Windows Server 2012 R2, Windows 8 and Windows Server 2012

Target Platforms

See Also

Reference

VirtualMachineDiskOperationsExtensions Class
VirtualMachineDiskOperationsExtensions Members
Microsoft.WindowsAzure.Management.Compute Namespace