다음을 통해 공유


Add-AzureDataDisk

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Add-AzureDataDisk

Adds a new data disk to a virtual machine object.

Syntax

Parameter Set: CreateNew
Add-AzureDataDisk [-CreateNew] [-DiskSizeInGB] <Int32> [-DiskLabel] <String> [-LUN] <Int32> -VM <IPersistentVM> [-HostCaching <String> ] [-MediaLocation <String> ] [ <CommonParameters>]

Parameter Set: Import
Add-AzureDataDisk [-Import] [-DiskName] <String> [-LUN] <Int32> -VM <IPersistentVM> [-HostCaching <String> ] [ <CommonParameters>]

Parameter Set: ImportFrom
Add-AzureDataDisk [-ImportFrom] [-DiskLabel] <String> [-LUN] <Int32> -MediaLocation <String> -VM <IPersistentVM> [-HostCaching <String> ] [ <CommonParameters>]

Detailed Description

This topic describes the cmdlet in the 0.8.10 version of the Microsoft Azure PowerShell module. To get the version of the module you're using, in the Azure PowerShell console, type (Get-Module -Name Azure).Version.

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

Specify to create a new data disk.

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?

3

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?

2

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-DiskSizeInGB<Int32>

Specifies the logical disk size in gigabytes.

Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

false

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

-Import

Imports an existing data disk from the disk library.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ImportFrom

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

Aliases

none

Required?

true

Position?

1

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?

4

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-MediaLocation<String>

Specifies the location of the blob in an 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 the container doesn’t exist, the container is created.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-VM<IPersistentVM>

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

Aliases

InputObject

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see  about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

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 Azure virtual machine.

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 current subscription.

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.

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