Add-​Azure​Rm​Vhd

Uploads a virtual hard disk from an on-premises virtual machine to a blob in a cloud storage account in Azure.

Syntax

Add-AzureRmVhd
   [[-ResourceGroupName] <String>]
   [-Destination] <Uri>
   [-LocalFilePath] <FileInfo>
   [[-NumberOfUploaderThreads] <Int32>]
   [[-BaseImageUriToPatch] <Uri>]
   [-OverWrite]
   [<CommonParameters>]

Description

The Add-AzureRmVhd cmdlet uploads 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 also.

Examples

Example 1: Add a VHD file

PS C:\> Add-AzureRmVhd -Destination "http://contosoaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd" -LocalFilePath "C:\vhd\Win7Image.vhd"

This command adds a .vhd file to a storage account.

Example 2: Add a VHD file and overwrite the destination

PS C:\> Add-AzureRmVhd -Destination "http://contosoaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd" -LocalFilePath "C:\vhd\Win7Image.vhd" -Overwrite

This command adds a .vhd file to a storage account. The command overwrites an existing file.

Example 3: Add a VHD file and specify the number of threads

PS C:\> Add-AzureRmVhd -Destination "http://contosoaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd" -LocalFilePath "C:\vhd\Win7Image.vhd" -NumberOfThreads 32

This command adds a .vhd file to a storage account. The command specifies the number of threads to use to upload the file.

Example 4: Add a VHD file and specify the SAS URI

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

This command adds a .vhd file to a storage account and specifies the SAS URI.

Required Parameters

-Destination

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

Type:Uri
Aliases:dst
Position:1
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-LocalFilePath

Specifies the path of the local .vhd file.

Type:FileInfo
Aliases:lf
Position:2
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-BaseImageUriToPatch

Specifies the URI to a base image blob in Azure Blob Storage. An SAS can be specified as the value for this parameter.

Type:Uri
Aliases:bs
Position:4
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-NumberOfUploaderThreads

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

Type:Int32
Aliases:th
Position:3
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-OverWrite

Indicates that this cmdlet overwrites an existing blob in the specified destination URI, if one exists.

Type:SwitchParameter
Aliases:o
Position:5
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ResourceGroupName

Specifies the name of the resource group of the virtual machine.

Type:String
Position:0
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False