Add-AzureRMVhd

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

Warning

The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.

Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.

Syntax

Add-AzureRMVhd
   [[-ResourceGroupName] <String>]
   [-Destination] <Uri>
   [-LocalFilePath] <FileInfo>
   [[-NumberOfUploaderThreads] <Int32>]
   [[-BaseImageUriToPatch] <Uri>]
   [-OverWrite]
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [<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" -NumberOfUploaderThreads 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.

Parameters

-AsJob

Run cmdlet in the background and return a Job to track progress.

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

-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
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure.

Type:IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-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
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-LocalFilePath

Specifies the 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 uploader threads to be used when uploading the .vhd file.

Type:Nullable<T>[Int32]
Aliases:th
Position:3
Default value:None
Required:False
Accept pipeline input:True
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
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ResourceGroupName

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

Type:String
Position:0
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

Inputs

String

Uri

FileInfo

Nullable<T>[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]

SwitchParameter

Outputs

VhdUploadContext