共用方式為


Add-AzureVhd

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

Add-AzureVhd

Uploads a virtual hard disk (in .vhd file format) from an on-premises virtual machine to a blob in a cloud storage account in Azure.

Syntax

Parameter Set: Vhd
Add-AzureVhd [-Destination] <Uri> [-LocalFilePath] <FileInfo> [[-NumberOfUploaderThreads] <Int32> ] [[-BaseImageUriToPatch] <Uri> ] [[-OverWrite]] [ <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-AzureVhd cmdlet allows you to upload on-premises virtual hard disks (in .vhd file format) to a blob storage account as fixed virtual hard disks. You can configure the number of uploader threads that will be used or overwrite an existing blob in the specified destination URI. Also supported is the ability to upload a patched version of an on-premises .vhd file: When a base virtual hard disk has already been uploaded, you can upload differencing disks that use the base image as the parent. Shared access signature (SAS URI) is supported as well.

Parameters

-BaseImageUriToPatch<Uri>

Specifies the URI to a base image blob in Azure Blob Storage. A shared access signature (SAS) can be specified as the value for this parameter.

Aliases

bs

Required?

false

Position?

5

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Destination<Uri>

Specifies the URI of a blob in Blob Storage. The parameter supports SAS URI, although patching scenarios destination cannot be an SAS URI.

Aliases

dst

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-LocalFilePath<FileInfo>

Specifies the path to the local .vhd file.

Aliases

lf

Required?

true

Position?

3

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-NumberOfUploaderThreads<Int32>

Determines the number of uploader threads to be used when uploading the .vhd file.

Aliases

th

Required?

false

Position?

4

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-OverWrite

If enabled, overwrites an existing blob in the specified destination URI, if one exists.

Aliases

o

Required?

false

Position?

6

Default Value

none

Accept Pipeline Input?

True (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: Use a destination URI to upload to a specified blob

This example uses a destination URI to a specific blob to upload a .vhd file to the blob.

PS C:\> Add-AzureVhd -Destination https://mytestaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd -LocalFilePath C:\vhd\MyWin7Image.vhd

Example 2: Use a SAS signature for the destination

This example uses a SAS signature in the query string of the URI to specify the destination. The SAS signature should have Read, Write, and Delete permissions.

C:\PS>Add-AzureVhd  -Destination "https://mytestaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd?st=2013-01-09T22%3A15%3A49Z&amp;se=2013-01-09T23%3A10%3A49Z&amp;sr=b&amp;sp=w&amp;sig=13T9Ow%2FRJAMmhfO%2FaP3HhKKJ6AY093SmveOSIV4%2FR7w%3D" -LocalFilePath C:\vhd\win7baseimage.vhd

Example 3: Overwrite an existing blob during upload

This example uploads a .vhd file and also overwrites any existing blob in the specified destination UIR.

C:\PS>Add-AzureVhd -Destination https://mytestaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd -LocalFilePath C:\vhd\MyWin7Image.vhd -Overwrite

Example 4: Specify the number of uploader threads

This example uploads a .vhd file and specifies the number of uploader threads.

C:\PS>Add-AzureVhd -Destination https://mytestaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd -LocalFilePath C:\vhd\MyWin7Image.vhd -NumberOfUploaderThreads 32

Add-AzureDataDisk

Update-AzureVM

Update-AzureVMImage

Manage Disks and Images