How to automate to move files from one location to other folder (Azure File Share)

Anonymous
2022-08-23T23:39:45.24+00:00

I am trying to come up with either a script or other process in Azure to move some files into a designated folder (for archiving).

I have been manually moving csv files using Azure Storage Explorer, but it has been time consuming process daily.

How do I go about doing it?

I am willing to script in Powershell or Python, not using other tool such as Power Automate, since it appears that I need to subscribe to it.

What is best practice to do this mundane task in Azure Portal /Azure environment?

234179-image.png

Thanks.

Azure Files
Azure Files
An Azure service that offers file shares in the cloud.
Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
0 comments No comments
{count} votes

Answer accepted by question author
  1. Manu Philip 20,491 Reputation points MVP Volunteer Moderator
    2022-08-24T04:43:36.093+00:00

    There are different ways available to schedule a task in Azure. One of the method is based on Azure Function App. Create a Function App based on Runtime Stack as PowerShell Core with the following PowerShell code.
    I have also detailed the procedure to show how to create a function app for this purpose in one of the 'comment' in the following question asked by a different customer
    function app

    $srcRGName = "name here"  
    $srcStgAccount = "qrfree"  
    $srcContainer = "source"  
    $blobName = "source1/test.txt"  
    $srcRGName = "name here"  
    $destStgAccount = "qrfree"  
    $destContainer = "archive"  
    $srcStorageKey = Get-AzStorageAccountKey -Name $srcStgAccount -ResourceGroupName $srcRGName   
    $destStorageKey = Get-AzStorageAccountKey -Name $destStgAccount -ResourceGroupName $srcRGName  
    $srcContext = New-AzStorageContext -StorageAccountName $srcStgAccount -StorageAccountKey $srcStorageKey.Value[0]  
    $destContext = New-AzStorageContext -StorageAccountName $destStgAccount -StorageAccountKey $destStorageKey.Value[0]  
    $copyOperation = Start-AzStorageBlobCopy -SrcBlob $blobName -SrcContainer $srcContainer -Context $srcContext -DestBlob $blobName -DestContainer $destContainer -DestContext $destContext -Force  
    

    ----------

    --please don't forget to upvote and Accept as answer if the reply is helpful--

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Henriech Monton 0 Reputation points
    2024-02-23T03:43:40.9266667+00:00

    I have same problem. And new to Azure. I need a step by step on how to do it.

    0 comments No comments

Your answer

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