Last active
August 24, 2023 14:56
-
-
Save mavaddat/f1c1c0859ede6bd683565220b38d627a to your computer and use it in GitHub Desktop.
PowerShell cmdlet to move Azure Storage blobgs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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