To convert blobs, copy them to a new location by using PowerShell, Azure CLI, or AzCopy. You'll use command parameters to ensure that the destination blob is a block blob. All metadata from the source blob is copied to the destination blob.
Convert append and page blobsOpen a Windows PowerShell command window.
Sign in to your Azure subscription with the Connect-AzAccount command and follow the on-screen directions.
Connect-AzAccount
If your identity is associated with more than one subscription, then set your active subscription to subscription of the storage account which contains the append or page blobs.
$context = Get-AzSubscription -SubscriptionId '<subscription-id>'
Set-AzContext $context
Replace the <subscription-id>
placeholder value with the ID of your subscription.
Create the storage account context by using the New-AzStorageContext command. Include the -UseConnectedAccount
parameter so that data operations will be performed using your Microsoft Entra credentials.
$ctx = New-AzStorageContext -StorageAccountName '<storage account name>' -UseConnectedAccount
Use the Copy-AzStorageBlob command and set the -DestBlobType
parameter to Block
.
$containerName = '<source container name>'
$srcblobName = '<source append or page blob name>'
$destcontainerName = '<destination container name>'
$destblobName = '<destination block blob name>'
$destTier = '<destination block blob tier>'
Copy-AzStorageBlob -SrcContainer $containerName -SrcBlob $srcblobName -Context $ctx -DestContainer $destcontainerName -DestBlob $destblobName -DestContext $ctx -DestBlobType Block -StandardBlobTier $destTier
To copy a page blob snapshot to block blob, use the Get-AzStorageBlob and Copy-AzStorageBlob command with -DestBlobType
parameter as Block
.
$containerName = '<source container name>'
$srcPageBlobName = '<source page blob name>'
$srcPageBlobSnapshotTime = '<snapshot time of source page blob>'
$destContainerName = '<destination container name>'
$destBlobName = '<destination block blob name>'
$destTier = '<destination block blob tier>'
Get-AzStorageBlob -Container $containerName -Blob $srcPageBlobName -SnapshotTime $srcPageBlobSnapshotTime -Context $ctx | Copy-AzStorageBlob -DestContainer $destContainerName -DestBlob $destBlobName -DestBlobType block -StandardBlobTier $destTier -DestContext $ctx
First, open the Azure Cloud Shell, or if you've installed the Azure CLI locally, open a command console application such as Windows PowerShell.
Note
If you're using a locally installed version of the Azure CLI, ensure that you are using version 2.44.0 or later.
If your identity is associated with more than one subscription, then set your active subscription to subscription of storage account which contains the append or page blobs.
az account set --subscription <subscription-id>
Replace the <subscription-id>
placeholder value with the ID of your subscription.
Use the az storage blob copy start command and set the --destination-blob-type
parameter to blockBlob
.
containerName = '<source container name>'
srcblobName = '<source append or page blob name>'
destcontainerName = '<destination container name>'
destBlobName = '<destination block blob name>'
destTier = '<destination block blob tier>'
az storage blob copy start --account-name $accountName --destination-blob $destBlobName --destination-container $destcontainerName --destination-blob-type BlockBlob --source-blob $srcblobName --source-container $containerName --tier $destTier
To copy a page blob snapshot to block blob, use the az storage blob copy start command and set the --destination-blob-type
parameter to blockBlob
along with source page blob snapshot uri.
srcPageblobSnapshotUri = '<source page blob snapshot uri>'
destcontainerName = '<destination container name>'
destblobName = '<destination block blob name>'
destTier = '<destination block blob tier>'
az storage blob copy start --account-name $accountName --destination-blob $destBlobName --destination-container $destcontainerName --destination-blob-type BlockBlob --source-uri $srcPageblobSnapshotUri --tier $destTier
Warning
The optional --metadata
parameter overwrites any existing metadata. Therefore, if you specify metadata by using this parameter, then none of the original metadata from the source blob will be copied to the destination blob.
Use the azcopy copy command. Specify the source and destination paths. Set the blob-type
parameter to BlockBlob
.
azcopy copy 'https://<storage-account-name>.<blob or dfs>.core.windows.net/<container-name>/<append-or-page-blob-name>' 'https://<storage-account-name>.<blob or dfs>.core.windows.net/<container-name>/<name-of-new-block-blob>' --blob-type BlockBlob --block-blob-tier <destination-tier>
Warning
The optional --metadata
parameter overwrites any existing metadata. Therefore, if you specify metadata by using this parameter, then none of the original metadata from the source blob will be copied to the destination blob.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4