Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Add-AzureDataDisk

Add-AzureDataDisk

microsoft.windowsazure.commands.servicemanagement.dll

Synopsis

Adds a new data disk to a virtual machine object.

Syntax

Add-AzureDataDisk [-CreateNew] [-DiskSizeInGB] [-DiskLabel] [-LUN] [-MediaLocation] [-HostCaching] [-VM] [<CommonParameters>]

Add-AzureDataDisk [-Import] [-DiskName] [-LUN] [-HostCaching] [-VM] [<CommonParameters>]

Add-AzureDataDisk [-ImportFrom] [-DiskLabel] [-LUN] [-MediaLocation] [-HostCaching] [-VM] [<CommonParameters>]

Detailed Description

The Add-AzureDataDisk cmdlet adds a new data disk to a virtual machine object. Use the –CreateNew parameter to create a new data disk with a specified size and label, and then attach it. Use the –Import parameter to attach an existing disk from the image repository. Use the –ImportFrom parameter to attach an existing disk from a blob in a storage account.The cmdlet allows you to specify the host-cache mode of attached data disks.

Parameters

-CreateNew <SwitchParameter>

Specify to create a new data disk.

Aliases

None

Required?

true

Position

0

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-DiskSizeInGB <Int32>

Specifies the logical disk size in gigabytes.

Aliases

None

Required?

true

Position

1

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-DiskLabel <String>

Specifies the disk label when creating a new data disk.

Aliases

None

Required?

true

Position

2

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-LUN <Int32>

Specifies the Logical Unit Number (LUN) location for the data drive in the virtual machine. Valid LUN values are 0-15 and each data disk must have a unique LUN.

Aliases

None

Required?

true

Position

3

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-MediaLocation <String>

Optional. Specifies the Location of the blob in a Microsoft Azure storage account where the data disk will be stored. If no location is specified, the data disk will be stored in the vhds container within the default storage account for the current subscription. If a vhds container doesn’t exist, the container is created

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-HostCaching <String>

Specifies the host level caching settings of the disk. Possible values are: None, ReadOnly and ReadWrite.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-VM <IPersistentVM>

Specifies the virtual machine object where the data disk will attach.

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

true (ByValue, ByPropertyName)

Accept wildcard characters?

false

-Import <SwitchParameter>

Imports an existing data disk from the disk library.

Aliases

None

Required?

true

Position

0

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-DiskName <String>

Specifies the name of the data disk in the disk repository.

Aliases

None

Required?

true

Position

1

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-ImportFrom <SwitchParameter>

Imports an existing data disk from a blob in a storage acount.

Aliases

None

Required?

true

Position

0

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

Input Type


Return Type


Notes

Examples

-------------------------- Example 1 --------------------------

This example gets a virtual machine object for the virtual machine named “MyVM” in the “myservice” cloud service, updates the virtual machine object by attaching an existing data disk from the repository using the disk name, and then updates the Microsoft Azure virtual machine.

PS C:\> C:\PS>Get-AzureVM "myservice" -Name "MyVM" `
          | Add-AzureDataDisk -Import -DiskName "MyExistingDisk" -LUN 0 `
          | Update-AzureVM

-------------------------- Example 2 --------------------------

This example updates the virtual machine by creating the new blank data disk “MyNewDisk.vhd” in the vhds container within the default storage account of the currently active subscription.

PS C:\> C:\PS>Get-AzureVM "myservice" -Name "MyVM" `
          | Add-AzureDataDisk -CreateNew -DiskSizeInGB 128 -DiskLabel "main" -LUN 0 `
          | Update-AzureVM

-------------------------- Example 3 --------------------------

This example updates a virtual machine by attaching an existing data disk from a storage location.

PS C:\> C:\PS>Get-AzureVM "myservice" -Name "Database" `
          | Add-AzureDataDisk -ImportFrom -MediaLocation `
          "https://mystorage.blob.core.windows.net/mycontainer/MyExistingDisk.vhd" `
          -DiskLabel "main" -LUN 0 `
          | Update-AzureVM

New-AzureVMConfig
Set-AzureDataDisk
Update-AzureVM