Edit

Share via


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

Default (Default)

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&amp;se=2013-01-09T23%3A10%3A49Z&amp;sr=b&amp;sp=w&amp;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.

Parameter properties

Type:Uri
Default value:None
Supports wildcards:False
DontShow:False
Aliases:bs

Parameter sets

(All)
Position:4
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments: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.

Parameter properties

Type:Uri
Default value:None
Supports wildcards:False
DontShow:False
Aliases:dst

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-InformationAction

Specifies how this cmdlet responds to an information event.

The acceptable values for this parameter are:

  • Continue
  • Ignore
  • Inquire
  • SilentlyContinue
  • Stop
  • Suspend

Parameter properties

Type:ActionPreference
Default value:None
Supports wildcards:False
DontShow:False
Aliases:infa

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InformationVariable

Specifies an information variable.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:iv

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-LocalFilePath

Species the file path of the local .vhd file.

Parameter properties

Type:FileInfo
Default value:None
Supports wildcards:False
DontShow:False
Aliases:lf

Parameter sets

(All)
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-NumberOfUploaderThreads

Specifies the number of threads to use for upload.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False
Aliases:th

Parameter sets

(All)
Position:3
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-OverWrite

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:o

Parameter sets

(All)
Position:5
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments: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.

Parameter properties

Type:AzureSMProfile
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.