Save-AzVhd
Saves downloaded .vhd images locally.
Syntax
ResourceGroupParameterSetName
Save-AzVhd
[-ResourceGroupName] <String>
[-SourceUri] <Uri>
[-LocalFilePath] <FileInfo>
[[-NumberOfThreads] <Int32>]
[-OverWrite]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
StorageKeyParameterSetName
Save-AzVhd
[-StorageKey] <String>
[-SourceUri] <Uri>
[-LocalFilePath] <FileInfo>
[[-NumberOfThreads] <Int32>]
[-OverWrite]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The Save-AzVhd cmdlet saves .vhd images from a blob where they are stored to a file.
You can specify the number of downloader threads that the process uses and whether to replace a file that already exists.
This cmdlet downloads content as it is.
It does not apply any Virtual Hard Disk (VHD) format conversion.
Examples
Example 1: Download an image
Save-AzVhd -SourceUri "http://contosoaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd" -LocalFilePath "C:\vhd\Win7Image.vhd" -ResourceGroupName "rgname"
This command downloads a .vhd file, and stores it in the local path C:\vhd\Win7Image.vhd.
Example 2: Download an image and overwrite the local file
Save-AzVhd -SourceUri "http://contosoaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd" -LocalFilePath "C:\vhd\Win7Image.vhd" -Overwrite -ResourceGroupName "rgname"
This command downloads a .vhd file, and stores it in the local path.
The command includes the Overwrite parameter.
Therefore, if C:\vhd\Win7Image.vhd already exists, this command replaces it.
Example 3: Download an image by using a specified number of threads
Save-AzVhd -SourceUri "http://contosoaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd" -LocalFilePath "C:\vhd\Win7Image.vhd" -NumberOfThreads 32 -ResourceGroupName "rgname"
This command downloads a .vhd file, and stores it in the local path.
The command specifies a value of 32 for the NumberOfThreads parameter.
Therefore, the cmdlet uses 32 threads for this action.
Example 4: Download an image and specify the storage key
Save-AzVhd -SourceUri "http://contosoaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd" -LocalFilePath "C:\vhd\Win7Image.vhd" -StorageKey "zNvcH0r5vAGmC5AbwEtpcyWCMyBd3eMDbdaa4ua6kwxq6vTZH3Y+sw=="
This command downloads a .vhd file and specifies the storage key.
Parameters
-AsJob
Run cmdlet in the background and return a Job to track progress.
Parameter properties
Type: SwitchParameter
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
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure.
Parameter properties
Type: IAzureContextContainer
Default value: None
Supports wildcards: False
DontShow: False
Aliases: AzContext, AzureRmContext, AzureCredential
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-LocalFilePath
Specifies the local file path of the saved image.
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: False
Value from remaining arguments: False
-NumberOfThreads
Specifies the number of download threads that this cmdlet uses during download.
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: False
Value from remaining arguments: False
-OverWrite
Indicates that this cmdlet replaces the file specified by LocalFilePath file if it exists.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Aliases: o
Parameter sets
(All)
Position: 4
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ResourceGroupName
Specifies the name of the resource group of the storage account.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ResourceGroupParameterSetName
Position: 0
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-SourceUri
Specifies the Uniform Resource Identifier (URI) of the blob in Azure
.
Parameter properties
Type: Uri
Default value: None
Supports wildcards: False
DontShow: False
Aliases: src, Source
Parameter sets
(All)
Position: 1
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-StorageKey
Specifies the storage key of the blob storage account.
If you do not specify a key, this cmdlet attempts to determine the storage key of the account in SourceUri from Azure.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: sk
Parameter sets
StorageKeyParameterSetName
Position: 0
Mandatory: True
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 .
Outputs