Add-AzureVhd

Uploads a VHD file from an on-premise computer to a blob in a cloud storage account in Azure.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement.

The Az PowerShell module is the recommended PowerShell module for managing Azure Resource Manager (ARM) resources with PowerShell.

Syntax

Add-AzureVhd
   [-Destination] <Uri>
   [-LocalFilePath] <FileInfo>
   [[-NumberOfUploaderThreads] <Int32>]
   [[-BaseImageUriToPatch] <Uri>]
   [-OverWrite]
   [-Profile <AzureSMProfile>]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [<CommonParameters>]

Description

The Add-AzureVhd cmdlet uploads on premise Virtual hard disk (VHD) images to a blob storage account as fixed .vhd images. It has parameters to configure the upload process such as specifying the number of uploader threads that will be used or overwriting a blob which already exists in the specified destination URI. For on premise VHD images, patching scenario is also supported so that diff disk images can be uploaded without having to upload the already uploaded base images. Shared Access Signature (SAS) URI is also supported.

Examples

Example 1: Add a VHD file

PS C:\> Add-AzureVhd -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-AzureVhd -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.

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

PS C:\> Add-AzureVhd -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 and 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-AzureVhd -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=<SAS Token>" -LocalFilePath "C:\vhd\win7baseimage.vhd"

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

Parameters

-BaseImageUriToPatch

Specifies an URI to a base image blob in Azure Blob Storage. SAS in URI input is supported as well.

Type:Uri
Aliases:bs
Position:4
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Destination

Specifies a URI to a blob in Microsoft Azure Blob Storage. SAS in URI input is supported. However, in patching scenarios the destination cannot be a SAS URI.

Type:Uri
Aliases:dst
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-InformationAction

Specifies how this cmdlet responds to an information event.

The acceptable values for this parameter are:

  • Continue
  • Ignore
  • Inquire
  • SilentlyContinue
  • Stop
  • Suspend
Type:ActionPreference
Aliases:infa
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InformationVariable

Specifies an information variable.

Type:String
Aliases:iv
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-LocalFilePath

Species the file path of the local .vhd file.

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

-NumberOfUploaderThreads

Specifies the number of threads to use for upload.

Type:Int32
Aliases:th
Position:3
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-OverWrite

Specifies that this cmdlet deletes the existing blob in the specified destination URI if it exists.

Type:SwitchParameter
Aliases:o
Position:5
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Type:AzureSMProfile
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False