Get-AzureStorageFileContent

Downloads the contents of a file.

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

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

Description

The Get-AzureStorageFileContent 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-AzureStorageFileContent -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: Download the files under sample file share

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

This example downloads the files under sample file share

Parameters

-CheckMd5

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

-ClientTimeoutPerRequest

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

-ConcurrentTaskCount

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

-Context

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:IStorageContext
Position:Named
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 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
Required:False
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-AzureStorageDirectory cmdlet. You can also use the Get-AzureStorageFile cmdlet to obtain a directory.

Type:CloudFileDirectory
Position:0
Default value:None
Required:True
Accept pipeline input:True
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-AzureStorageFile cmdlet.

Type:CloudFile
Position:0
Default value:None
Required:True
Accept pipeline input:True
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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PassThru

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

-ServerTimeoutPerRequest

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

Inputs

CloudFileShare

Parameters: Share (ByValue)

CloudFileDirectory

Parameters: Directory (ByValue)

CloudFile

Parameters: File (ByValue)

IStorageContext

Outputs

CloudFile