Get-AzStorageFileContent

Downloads the contents of a file.

Syntax

Get-AzStorageFileContent
   [-ShareName] <String>
   [-Path] <String>
   [[-Destination] <String>]
   [-CheckMd5]
   [-PassThru]
   [-Force]
   [-AsJob]
   [-Context <IStorageContext>]
   [-ServerTimeoutPerRequest <Int32>]
   [-ClientTimeoutPerRequest <Int32>]
   [-DefaultProfile <IAzureContextContainer>]
   [-ConcurrentTaskCount <Int32>]
   [-WhatIf]
   [-Confirm]
   [-PreserveSMBAttribute]
   [<CommonParameters>]
Get-AzStorageFileContent
   [-Share] <CloudFileShare>
   [-Path] <String>
   [[-Destination] <String>]
   [-CheckMd5]
   [-PassThru]
   [-Force]
   [-AsJob]
   [-ServerTimeoutPerRequest <Int32>]
   [-ClientTimeoutPerRequest <Int32>]
   [-DefaultProfile <IAzureContextContainer>]
   [-ConcurrentTaskCount <Int32>]
   [-WhatIf]
   [-Confirm]
   [-PreserveSMBAttribute]
   [<CommonParameters>]
Get-AzStorageFileContent
   [-Directory] <CloudFileDirectory>
   [-Path] <String>
   [[-Destination] <String>]
   [-CheckMd5]
   [-PassThru]
   [-Force]
   [-AsJob]
   [-ServerTimeoutPerRequest <Int32>]
   [-ClientTimeoutPerRequest <Int32>]
   [-DefaultProfile <IAzureContextContainer>]
   [-ConcurrentTaskCount <Int32>]
   [-WhatIf]
   [-Confirm]
   [-PreserveSMBAttribute]
   [<CommonParameters>]
Get-AzStorageFileContent
   [-File] <CloudFile>
   [[-Destination] <String>]
   [-CheckMd5]
   [-PassThru]
   [-Force]
   [-AsJob]
   [-ServerTimeoutPerRequest <Int32>]
   [-ClientTimeoutPerRequest <Int32>]
   [-DefaultProfile <IAzureContextContainer>]
   [-ConcurrentTaskCount <Int32>]
   [-WhatIf]
   [-Confirm]
   [-PreserveSMBAttribute]
   [<CommonParameters>]

Description

The Get-AzStorageFileContent cmdlet downloads the contents of a file, and then saves it to a destination that you specify. This cmdlet does not return the contents of the file.

Examples

Example 1: Download a file from a folder

PS C:\>Get-AzStorageFileContent -ShareName "ContosoShare06" -Path "ContosoWorkingFolder/CurrentDataFile"

This command downloads a file that is named CurrentDataFile in the folder ContosoWorkingFolder from the file share ContosoShare06 to current folder.

Example 2: Downloads the files under sample file share

PS C:\>Get-AzStorageFile -ShareName sample | ? {$_.GetType().Name -eq "CloudFile"} | Get-AzStorageFileContent

This example downloads the files under sample file share

Example 3: Download an Azure file to a local file, and perserve the Azure File SMB properties (File Attributtes, File Creation Time, File Last Write Time) in the local file.

PS C:\>Get-AzStorageFileContent -ShareName sample -Path "dir1/file1" -Destination $localFilePath -PreserveSMBAttribute

This example downloads an Azure file to a local file, and perserves the Azure File SMB properties (File Attributtes, File Creation Time, File Last Write Time) in the local file.

Parameters

-AsJob

Run cmdlet in the background.

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

Specifies whether to check the Md5 sum for the downloaded file.

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

Specifies the client-side time-out interval, in seconds, for one service request. If the previous call fails in the specified interval, this cmdlet retries the request. If this cmdlet does not receive a successful response before the interval elapses, this cmdlet returns an error.

Type:System.Nullable`1[System.Int32]
Aliases:ClientTimeoutPerRequestInSeconds
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ConcurrentTaskCount

Specifies the maximum concurrent network calls. You can use this parameter to limit the concurrency to throttle local CPU and bandwidth usage by specifying the maximum number of concurrent network calls. The specified value is an absolute count and is not multiplied by the core count. This parameter can help reduce network connection problems in low bandwidth environments, such as 100 kilobits per second. The default value is 10.

Type:System.Nullable`1[System.Int32]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-Context

Specifies an Azure Storage context. To obtain a context, use the New-AzStorageContext cmdlet.

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName, ByValue)
Accept wildcard characters:False
-DefaultProfile

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

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Destination

Specifies the destination path. This cmdlet downloads the file contents to the location that this parameter specifies. If you specify the path of a file that does not exist, this cmdlet creates that file, and saves the contents in the new file. If you specify a path of a file that already exists and you specify the Force parameter, the cmdlet overwrites the file. If you specify a path of an existing file and you do not specify Force, the cmdlet prompts you before it continues. If you specify the path of a folder, this cmdlet attempts to create a file that has the name of the Azure storage file.

Type:String
Position:2
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Directory

Specifies a folder as a CloudFileDirectory object. This cmdlet gets content for a file in the folder that this parameter specifies. To obtain a directory, use the New-AzStorageDirectory cmdlet. You can also use the Get-AzStorageFile cmdlet to obtain a directory.

Type:CloudFileDirectory
Position:0
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-File

Specifies a file as a CloudFile object. This cmdlet gets the file that this parameter specifies. To obtain a CloudFile object, use the Get-AzStorageFile cmdlet.

Type:CloudFile
Position:0
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-Force

If you specify the path of a file that does not exist, this cmdlet creates that file, and saves the contents in the new file. If you specify a path of a file that already exists and you specify the Force parameter, the cmdlet overwrites the file. If you specify a path of an existing file and you do not specify Force, the cmdlet prompts you before it continues. If you specify the path of a folder, this cmdlet attempts to create a file that has the name of the Azure storage file.

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

Indicates that this cmdlet returns the AzureStorageFile object that it downloads.

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

Specifies the path of a file. This cmdlet gets the contents the file that this parameter specifies. If the file does not exist, this cmdlet returns an error.

Type:String
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PreserveSMBAttribute

Keep the source File SMB properties (File Attributtes, File Creation Time, File Last Write Time) in destination File. This parameter is only available on Windows.

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

Specifies the service side time-out interval, in seconds, for a request. If the specified interval elapses before the service processes the request, the storage service returns an error.

Type:System.Nullable`1[System.Int32]
Aliases:ServerTimeoutPerRequestInSeconds
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Share

Specifies a CloudFileShare object. This cmdlet downloads the contents of the file in the share this parameter specifies. To obtain a CloudFileShare object, use the Get-AzStorageShare cmdlet. This object contains the storage context. If you specify this parameter, do not specify the Context parameter.

Type:CloudFileShare
Position:0
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-ShareName

Specifies the name of the file share. This cmdlet downloads the contents of the file in the share this parameter specifies.

Type:String
Position:0
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

CloudFileShare

CloudFileDirectory

CloudFile

Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext

Outputs

CloudFile