Automating Blob Copy from One Storage Container to Another in Azure

Abimbola Adeniran 66 Reputation points
2025-02-10T00:15:57.5366667+00:00

I'm looking for an efficient way to automate the copying of blobs (SQL backup files) from one Azure storage container to another. I've come across tools like Storage Explorer and AzCopy for one-off operations, but there's limited guidance on automating this process.

For context, daily backups are written to a storage account container (let's call it container x), and we've been requested to keep monthly backups of certain databases in another container (container y). While the mentioned tools can perform these tasks manually, the goal is to automate the process.

It's important that the solution has no dependencies on a virtual machine, as it is being decommissioned. A solution strictly within the storage account's capabilities is preferred.

What is the best and least time-consuming way to achieve this automation?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,331 questions
Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,362 questions
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,301 questions
0 comments No comments
{count} votes

Accepted answer
  1. Marcin Policht 35,200 Reputation points MVP
    2025-02-10T00:27:00.12+00:00

    Consider the following options:

    Option 1: Azure Storage object replication (best for simple automation) Object Replication allows automatic asynchronous replication of blobs from one container to another, even across different storage accounts.

    1. Define a replication policy on the source storage account.
    2. Set up rules specifying which blobs (e.g., backups in container x) should be replicated to container y.
    3. Azure automatically replicates new blobs based on the rules.

    Pros:

    • No compute dependency (fully managed by Azure).
    • Fully automatic, requiring no scripts or functions.
    • Supports cross-region replication, useful for compliance.

    Cons:

    • Does not support overwrites (if a blob is modified, the update is not replicated).
    • Applies at the container or storage account level, so it’s not as granular as scripting.

    More at https://learn.microsoft.com/en-us/azure/storage/blobs/object-replication-overview

    Option 2: Event Grid + Azure Functions (best for real-time, selective copying) Azure Event Grid can trigger an Azure Function whenever a new blob is uploaded to container x, automatically copying it to container y. You can also run this on schedule.

    1. Event Grid monitors container x for new blob uploads.
    2. It triggers an Azure Function
    3. The function uses Azure SDK or AzCopy to copy the blob to container y.

    Pros:

    • Real-time automation (copies the backup immediately after creation).
    • More flexible - you can filter by blob name, size, or metadata.
    • Supports overwrites and modifications.

    Cons:

    • Requires setup of Event Grid and Azure Functions.
    • More complex than Object Replication.

    Option 3: Logic Apps + AzCopy (no programming needed) Azure Logic Apps can be scheduled to run AzCopy commands to move files from container x to container y on a daily or monthly basis.

    1. Create a Logic App with a timer trigger (e.g., run every 24 hours or monthly).
    2. Use AzCopy within the Logic App to move the required blobs.

    Pros:

    • No programming needed
    • Supports overwrites and modifications.

    Cons:

    • Requires setup of Logic Apps.
    • Slightly slower than real-time triggers like Event Grid.

    If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    hth

    Marcin


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.