Module/Azure/Download-BCSFileFromAzureBlob.ps1
<#
.SYNOPSIS .DESCRIPTION .EXAMPLE .NOTES Author: Mathias Stjernfelt Website: http://www.brightcom.se #> function Download-BCSFileFromAzureBlob { [CmdletBinding(SupportsShouldProcess = $true)] Param ( [Parameter(ValueFromPipelineByPropertyName, Mandatory = $true)] [string]$storageAccountName, [Parameter(ValueFromPipelineByPropertyName, Mandatory = $true)] [string]$resourceGroupName, [Parameter(ValueFromPipelineByPropertyName, Mandatory = $true)] [string]$containerName, [Parameter(ValueFromPipelineByPropertyName, Mandatory = $true)] [string]$blobName, [Parameter(ValueFromPipelineByPropertyName, Mandatory = $true)] [string]$fileName ) process { try { $StorageContainers = Get-AzStorageAccount -ResourceGroupName $resourceGroupName -Name $storageAccountName $ctx = $StorageContainers.Context if ($PSCmdlet.ShouldProcess("Target", "Operation")) { Get-AzureStorageBlobContent -Container $containerName -Context $ctx -Blob $blobName -File $fileName -Force } } catch { throw "An error occured: $_.Exception"; } } } Export-ModuleMember -Function Download-BCSFileFromAzureBlob |