0
votes

My requirement is to create a blob trigger azure function which will be triggered when a specific file (say, trigger.txt) is copied into a container. Once it is triggered, the powershell function should copy this trigger.txt on to a Azure windows VM in the same same subscription and resource group.

I can see that the function is triggered if an example trigger.txt file is present.

What do I need to do to copy this blob in the container to the azure VM? I see that azcopy does not work.

1
Look into powershell remoting: thomasmaurer.ch/2019/07/…silent

1 Answers

0
votes

You could consider one of the following approaches

  • Using Azure File Storage

    1. Mount Azure File Storage onto Windows VM
    2. Azure Function would create a new file in file storage using content from input blob. Since there is no binding support for file strorage, you will have to use the File Storage SDK directly.

      You could also consider using Logic Apps which has connectors for both blob storage and file storage. But do note that there are file size restrictions that you may run into depending on your use case.

      And finally, you might want to consider using blob events to reduce on polling costs for both approaches.

  • Use PowerShell Functions to remote into the VM as suggested by @silent in the comments and run azcopy to download the file

    There is an official doc which showcases how you can run commands using remoting that you can refer to. The doc takes the context of remoting to an on-premises machine via a hybrid connection which you can ignore for your use case.

Also, if your VM doesn't have a public endpoint, you will have to use Premium Functions which support VNET Integration.