Schedule file copy between storage accounts

Matthews 21 Reputation points
2021-06-07T07:31:28.013+00:00

I need some help please, I can run the azcopy and rclone commands manually, but we have to prepare a scheduler script to run it on the cloud. Locally, I can set up a scheduler but I am not sure how to make it work on the cloud. I am looking for any sample bash or PowerShell script that will run the Azcopy or rclone commands on a schedule? The main goal is to copy the files from one storage account to another on a schedule.
I have an idea to log in using the service principal in the script and run it as a cron job but I am not sure how to implement it.

Azure Storage
Azure Storage
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,538 questions
0 comments No comments
{count} votes

Accepted answer
  1. shiva patpi 13,366 Reputation points Microsoft Employee Moderator
    2021-06-07T17:14:16.4+00:00

    Hello @Matthews ,
    Thanks for the query !
    You can try to use Azure Functions to schedule a job which supports CRON expression
    https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-scheduled-function

    Use the Timer Triggers of Azure functions
    https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-timer?tabs=csharp

    Basics of how Azure Functions works and their cost
    https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview

    Sample C#.net script to schedule a copy of blobs using Azure Functions:
    https://cmatskas.com/copy-azure-blob-data-between-storage-accounts-using-functions/

    Programmatic access which is alternative to azcopy using storage dotnet sdk
    https://azure.microsoft.com/en-us/blog/introducing-azure-storage-data-movement-library-preview-2/

    Another option is :-

    1. Create a Windows Azure VM
    2. Create a batch file - embed the AzCopy command
    3. Schedule that batch file through Windows Scheduler.

    Let us know if you need additional help on this .

    2 people found this answer helpful.
    0 comments No comments

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.