question

GopalKrishnan-6373 avatar image
0 Votes"
GopalKrishnan-6373 asked AnuragSingh-MSFT commented

Copy the .txt file from Azure Virtual Machine to Azure blob storage using Azure runbook ?

I have to copy a output file which is a .txt which is saved into Azure Virtual machine c: drive. I want to upload that .txt file to Azure storage. this i need to achieve via Azure run book. Please help here to provide the runbook which will do the above ask.

azure-automation
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

AnuragSingh-MSFT avatar image
0 Votes"
AnuragSingh-MSFT answered AnuragSingh-MSFT commented

Hi @GopalKrishnan-6373,

Welcome to Microsoft Q&A! Thanks for posting the question.

I understand that you are trying to upload content from local disk (c:) of an Azure VM to Azure blob storage. There are some open questions related to the mentioned scenario which will impact the design of solution, but the following links should get you started in the required direction:-

1. To upload a file to Azure blob storage, you may refer to the basic concept and PowerShell script available in this link: Quickstart: Upload, download, and list blobs with PowerShell

2. Tutorial: Create a PowerShell Workflow runbook in Automation


The following questions and corresponding references should help you decide on the final solution:

a. Is it always a particular VM from where you will have to upload the text file? If this is the scenario, you can make that VM a Hybrid Runbook Worker for Azure Automation. This will enable the Azure Automation script to always execute on that machine, which can contain logic to upload the text file to Azure Blob. Please refer to this link for more details: Automation Hybrid Runbook Worker overview

b. If the VM can change, from where the .txt file is to be uploaded, you may refer to this thread containing generic information on how to run a command/script on a VM on Azure Automation.

c If the .txt file, of interest, is being generated from custom code, you might consider using the Azure SDK to upload the file to Blob Storage as part of the application logic.

d. In case the file being generated is a log which is to be stored for analysis, the custom logs with Log Analytics agent would be a better choice that storing it in blob. This will give you an opportunity to analyze the logs collected using KQL queries in Log Analytics workspace.

Please let me know if you have any questions.


Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.

· 1
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.

@GopalKrishnan-6373, I wanted to check if you had a chance to review my answer above. Please let me know if you have any queries or concerns.

Please 'Accept as answer' if it helped so that it can help others in the community looking for help on similar topics.

0 Votes 0 ·