I need Powershell script to download file with current date as filename from Azure blob,like for example
app_09102021.txt
app_10102021.txt
app_11102021.txt
if i run the script on 11-10-2021, the file app_11102021.txt
should get download. Could you please help.
I tried the below code, but error at 5th line $latestblob
$container_name = 'XXXX'
$destination_path = 'D:\test\trial'
$Ctx = New-AzStorageContext $XXXX -StorageAccountKey $YYYYYYY
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
#$latestBlob = Get-AzStorageBlob -context $Ctx -Container trial|@{$app_$((Get-Date).tostring("yyyyMMdd")).txt}
# Just download that blob
Get-AzStorageBlobContent -Context $Ctx -Container $container_name -Blob $latestBlob.Name -Destination $destination_path