Skip to content

Instantly share code, notes, and snippets.

@mavaddat
Last active August 24, 2023 14:56
Show Gist options
  • Save mavaddat/f1c1c0859ede6bd683565220b38d627a to your computer and use it in GitHub Desktop.
Save mavaddat/f1c1c0859ede6bd683565220b38d627a to your computer and use it in GitHub Desktop.
PowerShell cmdlet to move Azure Storage blobgs
function Move-AzStorageBlob {
#Requires -Modules Az.Storage, Az.Accounts
[CmdletBinding()]
param (
$SrcBlob,
$SrcContainer,
$DestContainer,
$DestBlob,
$Context
)
begin {
$Copy = $null
}
process {
$Copy = Copy-AzStorageBlob -SrcBlob $SrcBlob -SrcContainer $SrcContainer -DestContainer $DestContainer -DestBlob $DestBlob -Context $Context -Verbose:$VerbosePreference
if ($Copy) {
Remove-AzStorageBlob -Blob $SrcBlob -Container $SrcContainer -Context $Context -Verbose:$VerbosePreference
}
}
end {
$Copy
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment