In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Suppose we have an application that stores files in Azure Blob, data stored in Blob for seven days, and needs to be deleted seven days later. This can be done using Azure PowerShell Runbook, but I want to see if it can be done with little or no code. After some exploration, I found that Azure Logic App is very suitable for this situation. You can create something powerful with Logic App. So in this article, I'll show you how to delete files longer than X days in Blob using Logic App.
As for how to create Logic App, I will not explain too much here, if you are interested, you can refer to my previous Blog. When we have created the Logic App, we open a new logical application. We should see logical Application designer, click logical Application designer-"Blank Logic App":
Search for "Recurrence" in the search connector and trigger box and click the "Recurrence" trigger:
Set the interval so that you want the logical application to run every few days. Here I choose to run it every day, and then click Show Advanced options. Here, select the time zone and time where we want the logical application to run. I chose UTC+8 and midnight. Click next when you are finished.
Search for "blob" in the search connector and trigger box and click the "List blobs" trigger:
Enter the connection name. We will see a list of storage accounts and click the storage account you want to clean up. Then click create, and now we are asked to specify Container. Click the folder icon and select the Container you want to clean up:
Search for "Filte" in the search connector and trigger box and click the "Filter array" trigger:
Select Value under list blobs:
Click Edit in Advanced Mode, and then type the following to clear files that are more than 7 days old. Then click next:
@ less (item ()? ['LastModified'], addDays (utcNow (),-7))
Search for "For each" in the search connector and trigger box and click the "For each" trigger:
Select "Body" under Filter array:
Click add Action.
Search for "Delete blob" and click "Delete Blob":
Select "Path":
At this point, our logic app has been designed. Click Save:
Let's test Logic App to make sure it can attack errors properly. As you can see in my Blob store, I have some files that have different modification dates, most of which are more than 7 days old.
For the Logic app we just created, if we want to run it immediately, just click "Run Trigger":
After clicking run, you can see the running record below:
When we return to blob after running, we can see that all the files created 7 days ago have been deleted:
This method of cleaning up files in Blob storage is simple and does not require any special Azure RunAs account as it does with Azure Automation Runbook.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.