Copy Blobs from Azure Blob Storage Containers: Step-by-Step Guide

Copy Blobs from Container1 to Container2 in Azure Blob Storage

Question

You develop an app that allows users to upload photos and videos to Azure storage.

The app uses a storage REST API call to upload the media to a blob storage account named Account1

You have blob storage containers named Container1 and Container2

Uploading of videos occurs on an irregular basis.

You need to copy specific blobs from Container1 to Container2 when a new video is uploaded.

What should you do?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

B.

The Start-AzureStorageBlobCopy cmdlet starts to copy a blob.

Example 1: Copy a named blob - C:\PS>Start-AzureStorageBlobCopy -SrcBlob "ContosoPlanning2015" -DestContainer "ContosoArchives" -SrcContainer "ContosoUploads" This command starts the copy operation of the blob named ContosoPlanning2015 from the container named ContosoUploads to the container named ContosoArchives.

https://docs.microsoft.com/en-us/powershell/module/azure.storage/start-azurestorageblobcopy?view=azurermps-6.13.0

The best option for copying specific blobs from Container1 to Container2 when a new video is uploaded is to create an Azure Event Grid topic that uses the Start-AzureStorageBlobCopy cmdlet.

Option A is incorrect because the Put Blob operation of the Blob Service REST API is used to upload a new blob to a container. It is not designed to copy an existing blob from one container to another.

Option C is also incorrect because AzCopy with the Snapshot switch is used to create a point-in-time copy of a blob. It is not designed to copy an existing blob from one container to another.

Option D is also incorrect because downloading and then uploading the blob to a virtual machine would be inefficient and time-consuming.

Therefore, option B is the correct answer. Azure Event Grid is a fully managed event routing service that allows developers to build event-based architectures. It can be used to monitor Blob storage accounts for specific events, such as the creation of new blobs, and trigger actions in response to those events.

To implement this solution, follow these steps:

  1. Create an Azure Event Grid topic and subscription for your Blob storage account. This can be done using the Azure Portal or the Azure CLI.

  2. Configure the subscription to filter for the specific event you want to monitor, which is the creation of new blobs in Container1.

  3. Create a webhook that uses the Start-AzureStorageBlobCopy cmdlet to copy the specific blob from Container1 to Container2 when the event is triggered.

  4. Test the solution by uploading a new video to Container1 and verifying that the blob is copied to Container2.

By using Azure Event Grid and the Start-AzureStorageBlobCopy cmdlet, you can automate the process of copying specific blobs from one container to another, which will save time and improve efficiency.