Convert append blobs and page blobs into block blobs
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 blobs
Open 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 toBlock
.$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 asBlock
.$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
Tip
The
-StandardBlobTier
parameter is optional. If you omit that parameter, then the destination blob infers its tier from the default account access tier setting. To change the tier after you've created a block blob, see Change a blob's tier.