Skip to content

Commit a192d04

Browse files
committed
add CLI example
1 parent fc43163 commit a192d04

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

articles/storage/blobs/archive-rehydrate-overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Microsoft recommends performing a copy operation in most scenarios where you nee
5454
- A copy operation avoids the early deletion fee that is assessed if you change the tier of a blob from the Archive tier before the required 180-day period elapses. For more information, see [Archive access tier](access-tiers-overview.md#archive-access-tier).
5555
- If there is a lifecycle management policy in effect for the storage account, then rehydrating a blob with [Set Blob Tier](/rest/api/storageservices/set-blob-tier) can result in a scenario where the lifecycle policy moves the blob back to the Archive tier after rehydration because the last modified time is beyond the threshold set for the policy. A copy operation leaves the source blob in the Archive tier and creates a new blob with a different name and a new last modified time, so there is no risk that the rehydrated blob will be moved back to the Archive tier by the lifecycle policy.
5656

57-
Copying a blob from the Archive tier can take hours to complete depending on the rehydration priority selected. Behind the scenes, a blob copy operation reads your archived source blob to create a new online blob in the selected destination tier. The new blob may be visible when you list the blobs in the parent container before the rehydration operation is complete, but its tier will be set to Archive, The data is not available until the read operation from the source blob in the Archive tier is complete and the blob's contents have been written to the new destination blob in an online tier. The new blob is an independent copy, so modifying or deleting it does not affect the source blob in the Archive tier.
57+
Copying a blob from the Archive tier can take hours to complete depending on the rehydration priority selected. Behind the scenes, a blob copy operation reads your archived source blob to create a new online blob in the selected destination tier. The new blob may be visible when you list the blobs in the parent container before the rehydration operation is complete, but its tier will be set to Archive. The data is not available until the read operation from the source blob in the Archive tier is complete and the blob's contents have been written to the new destination blob in an online tier. The new blob is an independent copy, so modifying or deleting it does not affect the source blob in the Archive tier.
5858

5959
To learn how to rehydrate a blob by copying it to an online tier, see [Rehydrate a blob with a copy operation](archive-rehydrate-to-online-tier.md#rehydrate-a-blob-with-a-copy-operation).
6060

articles/storage/blobs/archive-rehydrate-to-online-tier.md

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ N/A
9999

100100
#### [PowerShell](#tab/azure-powershell)
101101

102-
To copy an archived blob to a blob in an online tier in a different storage account with PowerShell, make sure you have installed the [Az.Storage](https://www.powershellgallery.com/packages/Az.Storage/) module, version 4.4.0 or higher. Next, call the [Start-AzStorageBlobCopy](/powershell/module/az.storage/start-azstorageblobcopy) command and specify the target tier and the rehydration priority. You must specify a shared access signature (SAS) with read permissions for the archived source blob.
102+
To copy an archived blob to a blob in an online tier in a different storage account with PowerShell, make sure you have installed the [Az.Storage](https://www.powershellgallery.com/packages/Az.Storage/) module, version 4.4.0 or higher. Next, call the [Start-AzStorageBlobCopy](/powershell/module/az.storage/start-azstorageblobcopy) command and specify the target online tier and the rehydration priority. You must specify a shared access signature (SAS) with read permissions for the archived source blob.
103103

104104
The following example shows how to copy an archived blob to the Hot tier in a different storage account. Remember to replace placeholders in angle brackets with your own values:
105105

@@ -126,7 +126,7 @@ $srcCtx = (Get-AzStorageAccount `
126126
$srcBlobUri = New-AzStorageBlobSASToken -Container $srcContainer `
127127
-Blob $srcBlob `
128128
-Permission rwd `
129-
-ExpiryTime (Get-Date).AddDays(7) `
129+
-ExpiryTime (Get-Date).AddDays(1) `
130130
-FullUri `
131131
-Context $srcCtx
132132
@@ -141,7 +141,36 @@ Start-AzStorageBlobCopy -AbsoluteUri $srcBlobUri `
141141

142142
#### [Azure CLI](#tab/azure-cli)
143143

144-
TBD
144+
To copy an archived blob to a blob in an online tier in a different storage account with the Azure CLI, make sure you have installed version 2.35.0 or higher. Next, call the [az storage blob copy start](/cli/azure/storage/blob/copy#az-storage-blob-copy-start) command and specify the target online tier and the rehydration priority. You must specify a shared access signature (SAS) with read permissions for the archived source blob.
145+
146+
The following example shows how to copy an archived blob to the Hot tier in a different storage account. Remember to replace placeholders in angle brackets with your own values:
147+
148+
```azurecli
149+
# Specify the expiry interval
150+
end=`date -u -d "1 day" '+%Y-%m-%dT%H:%MZ'`
151+
152+
# Get a SAS for the source blob
153+
srcBlobUri=$(az storage blob generate-sas \
154+
--account-name <source-account> \
155+
--container <source-container> \
156+
--name <archived-source-blob> \
157+
--permissions rwd \
158+
--expiry $end \
159+
--https-only \
160+
--full-uri \
161+
--as-user \
162+
--auth-mode login | tr -d '"')
163+
164+
# Copy to the destination blob in the Hot tier
165+
az storage blob copy start \
166+
--source-uri $srcBlobUri \
167+
--account-name <dest-account> \
168+
--destination-container <dest-container> \
169+
--destination-blob <dest-blob> \
170+
--tier Hot \
171+
--rehydrate-priority Standard \
172+
--auth-mode login
173+
```
145174

146175
---
147176

0 commit comments

Comments
 (0)