Invoke D365AzureStorageDownload - FH-Inway/d365fo.tools GitHub Wiki
Download a file to Azure
Invoke-D365AzureStorageDownload [-AccountId <String>] [-AccessToken <String>] [-SAS <String>]
[-Container <String>] -FileName <String> [-Path <String>] [-Force] [-EnableException] [<CommonParameters>]
Invoke-D365AzureStorageDownload [-AccountId <String>] [-AccessToken <String>] [-SAS <String>]
[-Container <String>] [-Path <String>] [-Latest] [-Force] [-EnableException] [<CommonParameters>]
Download any file to an Azure Storage Account
Invoke-D365AzureStorageDownload -AccountId "miscfiles" -AccessToken "xx508xx63817x752xx74004x30705xx92x58349x5x78f5xx34xxxxx51" -Container "backupfiles" -FileName "OriginalUAT.bacpac" -Path "c:\temp"
Will download the "OriginalUAT.bacpac" file from the storage account and save it to "c:\temp\OriginalUAT.bacpac"
Invoke-D365AzureStorageDownload -AccountId "miscfiles" -AccessToken "xx508xx63817x752xx74004x30705xx92x58349x5x78f5xx34xxxxx51" -Container "backupfiles" -Path "c:\temp" -Latest
Will download the file with the latest modified datetime from the storage account and save it to "c:\temp". The complete path to the file will returned as output from the cmdlet.
$AzureParams = Get-D365ActiveAzureStorageConfig
PS C:\> Invoke-D365AzureStorageDownload @AzureParams -Path "c:\temp" -Latest
This will get the current Azure Storage Account configuration details and use them as parameters to download the latest file from an Azure Storage Account
Will download the file with the latest modified datetime from the storage account and save it to "c:\temp". The complete path to the file will returned as output from the cmdlet.
Invoke-D365AzureStorageDownload -Latest
This will use the default parameter values that are based on the configuration stored inside "Get-D365ActiveAzureStorageConfig". Will download the file with the latest modified datetime from the storage account and save it to "c:\temp\d365fo.tools".
Invoke-D365AzureStorageDownload -AccountId "miscfiles" -SAS "sv2018-03-28&siunlisted&src&sigAUOpdsfpoWE976ASDhfjkasdf(5678sdfhk" -Container "backupfiles" -Path "c:\temp" -Latest
Will download the file with the latest modified datetime from the storage account and save it to "c:\temp". A SAS key is used to gain access to the container and downloading the file from it. The complete path to the file will returned as output from the cmdlet.
Storage Account Name / Storage Account Id where you want to fetch the file from
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: $Script:AzureStorageAccountId
Accept pipeline input: False
Accept wildcard characters: False
The token that has the needed permissions for the download action
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: $Script:AzureStorageAccessToken
Accept pipeline input: False
Accept wildcard characters: False
The SAS key that you have created for the storage account or blob container
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: $Script:AzureStorageSAS
Accept pipeline input: False
Accept wildcard characters: False
Name of the blob container inside the storage account you where the file is
Type: String
Parameter Sets: (All)
Aliases: Blobname, Blob
Required: False
Position: Named
Default value: $Script:AzureStorageContainer
Accept pipeline input: False
Accept wildcard characters: False
Name of the file that you want to download
Type: String
Parameter Sets: Default
Aliases: Name
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Path to the folder / location you want to save the file
The default path is "c:\temp\d365fo.tools"
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: $Script:DefaultTempPath
Accept pipeline input: False
Accept wildcard characters: False
Instruct the cmdlet to download the latest file from Azure regardless of name
Type: SwitchParameter
Parameter Sets: Latest
Aliases: GetLatest
Required: True
Position: 5
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Instruct the cmdlet to overwrite the local file if it already exists
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
This parameters disables user-friendly warnings and enables the throwing of exceptions This is less user friendly, but allows catching exceptions in calling scripts
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Tags: Azure, Azure Storage, Config, Configuration, Token, Blob, File, Files, Latest, Bacpac, Container
Author: Mötz Jensen (@Splaxi)
The cmdlet supports piping and can be used in advanced scenarios. See more on github and the wiki pages.