Download A blob from an azure container and delete it once downloaded from blob

As move functionality has been removed from azcopy so there is no direct command which we can use to cut blob from container and download it on server.

If you want such for log shipping of Database you can use below script.

<#azcopy file location #>
 $azcopylocation="D:\azcopy\AzCopy"

<#To remove cache of azcopy if exist#>
 $Journal = “$env:LocalAppData\Microsoft\Azure\AzCopy”
 Get-ChildItem -Path $Journal -file |Remove-Item

$pattern = "*.bak" # type of file whcih you want to copy use * if you want to move all types of file

<#how to create context of storage account#>
 $StorageAccountName = "azcopydownload"
 $StorageAccountKey = "storage account key"
 $ctx = New-AzureStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $StorageAccountKey
 $containerName="azcopy" #container name where blobs exist

$source="https://azcopydownload.blob.core.windows.net/azcopy"
 $destination="D:\azcopy1234"

$files=(Get-AzureStorageBlob -Container $ContainerName -Context $ctx).name
 Cd $azcopylocation
 foreach($file in $files)
 {
 if($file -like $pattern)
 {
 $result = $null
 $breakresult = $null
 $result=.\AzCopy.exe /source:"$source" /dest:"$destination" /sourcekey:$StorageAccountKey /pattern:"$file" /y
 $breakresult=$Result.split()
 if ($breakresult[8] -eq $breakresult[13] -and $breakresult[34] -eq "0")
 {
 Remove-AzureStorageBlob -Blob $file -Container $ContainerName -Context $ctx
 }
 else
 {
 Write-Host "ERROR, copy failed !"
 }
 $result
 }
 }