How to Create an Azure Function to Zip Files via Power Automate or Logic Apps

  Рет қаралды 2,481

DamoBird365

DamoBird365

Күн бұрын

In this video, I will show you how to create an Azure Function that can accept base64 file content for an array of files and output a compressed file / zip file. This function can be useful for scenarios where you need to compress files from different sources and store or send them to different destinations, such as SFTP, Blob, email, OneDrive or SharePoint.
I will also show you how to test the function from the Azure portal and how to use it from Power Automate or Logic Apps.
Even if you don't plan on compressing files via an Azure Function, see how easy it is to build fusion solutions using Azure and the Power Platform where procode and low code meet Extend your functionality using the Microsoft Stack.
0:00 - Introduction
0:41 - Creating the Azure Function from the portal
3:11 - The C# code for the function
4:58 - Using the function from Power Automate
07:52 - Adding dynamic files to the zip
12:35 - Reviewing the flow history and zip file content
14:31 - Conclusion and summary
Check out my blog post too:
www.damobird365.com/how-to-se...
Please buy me a coffee www.buymeacoffee.com/DamoBird365 ☕

Пікірлер: 24
@dougydoe
@dougydoe 6 ай бұрын
Great stuff Damien. Very similar to the one you helped me with the power automate sometime last year although mine was a python script. Enjoyed watching the video and picked up a few tips as well. Thanks for sharing.
@DamoBird365
@DamoBird365 6 ай бұрын
Cheers Douglas. Definitely. It’s amazing what can be achieved so easily with the fusion of the low and pro code. It sure beats the old days of writing a batch script and running a scheduled task. Or am I just showing my age? 💾
@dougydoe
@dougydoe 6 ай бұрын
@@DamoBird365 Hahaha, yes, it beats the "old school" way of doing some of these tasks.
@AdiCristea
@AdiCristea 6 ай бұрын
This is awesome, Damien, more Azure Functions videos, please. Interestingly enough, just a few weeks ago I was trying to create a function that does the opposite (extract the files from a zip file passed as base64) and could not do it. It sparked my interest again after your video, but still haven't managed to push over the finish line...
@DamoBird365
@DamoBird365 6 ай бұрын
Cheers Adi. Appreciated. If you’re still struggling in a week or so, let me know and I can try it out. There is an extract folder action for SharePoint but presumably you don’t want to save to SharePoint, which is my use case here.
@AdiCristea
@AdiCristea 6 ай бұрын
@@DamoBird365 Thank you very much for replying, SharePoint is fine, but I believe the Extract only handles 50MB or something similar, the file I am looking to extract can have anything between 100-250MB I'm afraid. Happy to hear other about other options also, the idea is to be able to use Power Automate or Logic Apps just because the file is being retrieved with a HTTP call from an API.
@ResponsibleXI
@ResponsibleXI 7 ай бұрын
Great one as I am just new to Azure itself. Can you make more videos on Azure Functions? How do we determine that certain automations can be done with the Azure Functions?
@DamoBird365
@DamoBird365 6 ай бұрын
Cheers 👋 what sort of videos do you want to see? Have you got any ideas? Functions are just one of the many ways to build your own hosted pro code solution, albeit this was a relatively simple example. I hope it gives you ideas.
@ResponsibleXI
@ResponsibleXI 6 ай бұрын
@@DamoBird365 Is it possible to do image compression on images stored on Azure Blob with Azure Functions and Power Automate?
@DamoBird365
@DamoBird365 6 ай бұрын
@ResponsibleXI it must be possible. Just got to work out the code. Maybe worth reaching out to Tareq, www.linkedin.com/feed/update/urn:li:activity:7150027422011199488?commentUrn=urn%3Ali%3Acomment%3A%28activity%3A7150027422011199488%2C7150411081847345153%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287150411081847345153%2Curn%3Ali%3Aactivity%3A7150027422011199488%29
@zahsam09
@zahsam09 2 ай бұрын
Great video @Damien!! A very quick question on the limitations (if any): Is there any limit on the number of files that could be archived together or maybe a limit on the overall size of the files being zipped together? Please let me know your thoughts. Many Thanks! 🙂
@DamoBird365
@DamoBird365 2 ай бұрын
I would believe it would be limited by the request body limit learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook-trigger?tabs=python-v2%2Cin-process%2Cnodejs-v4%2Cfunctionsv2&pivots=programming-language-csharp#limits
@hchchc2
@hchchc2 3 ай бұрын
Love the video, Damien. Can you suggest how you could use the function to zip up a folder that includes a few files or create a folder inside the function, put the files inside, and then zip it up?
@DamoBird365
@DamoBird365 3 ай бұрын
You could certainly redevelop the code of this to achieve what you’re looking for.
@hchchc2
@hchchc2 3 ай бұрын
@@DamoBird365 that's fair. Can't expect you to have all the fun 😀. One issue I ran into though was when I try to create a file in SharePoint or OneDrive using the Body of the HTTP action, yours comes out as a string starting with "UEsD..." in the video. Mine comes out as the binary as you see in the Azure Function. Do I need to do some conversion of the output?
@Tiago22049316
@Tiago22049316 6 ай бұрын
Nice video Damien! Do you know if it is possible to create a function here that joins two PDFs? I say put one under the other and stay as one. Currently I've only seen this in Power Automate with connectors that need to pay third parties to use, even with premium connectors. It would be something interesting for you to show :) And congratulations on the work, I've been following your videos for a while and I've learned a lot
@DamoBird365
@DamoBird365 6 ай бұрын
Interesting challenge. I can take a look. Thank you for your encouragement too 👍
@sachidanandanaik7690
@sachidanandanaik7690 2 ай бұрын
@Damo : please let me know how I can convert the response object of the function to base64. I’m trying to send the response object of the function app to another rest API, I need to send it as base 64.
@DamoBird365
@DamoBird365 2 ай бұрын
There is a base64() expression in Power Automate?
@JasonZhang-hs2xo
@JasonZhang-hs2xo 4 ай бұрын
Hi I am trying to do something similar. Instead of zipping the files, I am trying to convert xlsx files to xlsb with azure function. I am having trouble figuring out what to return from the azure function after passing the xlsx file content to it. Should I return the xlsb file content in the same base65 encoding? Would I be able to create the file on Sharepoint with the encoding? Any help is appreciated.
@DamoBird365
@DamoBird365 3 ай бұрын
If you return as base64 you should then be able to use create file?
@JasonZhang-hs2xo
@JasonZhang-hs2xo 3 ай бұрын
@@DamoBird365 Hi Damien, thank you for your response. It turned out that converting xlsx to xlsb is quite tricky to do with azure function. I've tried both node.js, python. Both runtime use open-source libraries that rely on their own interpretation of the excel structure so it might be a hit or miss. Proper conversion requires excel to be pre-installed in the environment that azure function runs on. It involves opening the excel files with excel API then saving it as xlsb in a windows OS. Azure functions runs in barebone windows or linux environment so it can't be done there. Please let me know if you find a way.
Unlock the Power: Integrating External API's in Power Apps!
28:41
Secret Experiment Toothpaste Pt.4 😱 #shorts
00:35
Mr DegrEE
Рет қаралды 36 МЛН
Why Is He Unhappy…?
00:26
Alan Chikin Chow
Рет қаралды 56 МЛН
Relationship Between Logic Apps & Power Automate
14:37
John Savill's Technical Training
Рет қаралды 11 М.
Work with Files and Folders in Power Automate Desktop
21:13
Anders Jensen
Рет қаралды 95 М.
Remove Text between Values in Power Automate
3:52
Encodian
Рет қаралды 364
How to Create an Azure Function App Using C# | .NET 6
12:49
Claudio Bernasconi
Рет қаралды 67 М.
Power Automate (Flow) vs Azure Logic Apps EXPLAINED! (6 Key Differences)
6:43
НОВЫЕ ФЕЙК iPHONE 🤯 #iphone
0:37
ALSER kz
Рет қаралды 355 М.
تجربة أغرب توصيلة شحن ضد القطع تماما
0:56
صدام العزي
Рет қаралды 63 МЛН
Что делать если в телефон попала вода?
0:17
Лена Тропоцел
Рет қаралды 3,2 МЛН
Запрещенный Гаджет для Авто с aliexpress 2
0:50
Тимур Сидельников
Рет қаралды 949 М.