question

Matthews-6806 avatar image
0 Votes"
Matthews-6806 asked shivapatpi-MSFT answered

Schedule file copy between storage accounts

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-accounts
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

shivapatpi-MSFT avatar image
1 Vote"
shivapatpi-MSFT answered

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

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

Basics of how Azure Functions works and their cost
https://docs.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 .



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.