Misc/Get-FileFromStorage.ps1

<#
.synopsis
    Download file from a storage account
.description
    Downloads a filed from a storage account without requiring authentication
.parameter fileName
    Url to the file
.example
    $filename = Get-FileFromStorage -fileName "https://storageurl"
#>

function Get-FileFromStorage {
    Param(
        [Parameter(Mandatory=$true)]
        [string]
        $fileName
    )
    if ($fileName.StartsWith("https://") -or $fileName.StartsWith("http://"))
    {
        $fileNameUrl = $fileName
        $tempFilename = New-TemporaryFile
        Rename-Item $tempFilename.FullName (split-path ("{0}.{1}" -f $tempFilename.FullName.Substring(0, $tempFilename.FullName.LastIndexOf('.')), ((Split-Path $fileNameUrl -Leaf).Split('?')[0].Split('.')[-1])) -Leaf) -Force
        $tempFilename = ("{0}.{1}" -f $tempFilename.FullName.Substring(0, $tempFilename.FullName.LastIndexOf('.')), ((Split-Path $fileNameUrl -Leaf).Split('?')[0].Split('.')[-1]))
        (New-Object System.Net.WebClient).DownloadFile($fileNameUrl, $tempFilename)
        $tempFilename
    }
    else {
        $fileName
    }
}