In the Azure Cost Management > Export, there is an export called Daily export of month-to-date
:
Such export happens daily and it's exported to a Blob Storage.
PROBLEM: Because it's a month-to-day export, if today it's the 26 or April, today it will create a .csv file with all the Cost Management information from the 1th of April to the 26th.
But tomorrow another .csv file will be generated with all the costs from the 1th of April to the 27th.
This way I will have double informations!
GOAL: an ideal solution would be that as soon as a new file is exported to that Storage Account the old file is deleted.
So there is always only 1 .csv file that contains all the data from month-to-date.
SCOPE: Everything can be in scope:
- Azure Data Factory
- Logic Apps
- Automation Accounts
- Power Automate
...whatever works.
I have reproduced in my environment and got expected results as below:
Design:
Clearly: You can reproduce the above design with below code:
Logic app code:
Firstly have 1 blob like below:
Blob can be of any type.
Then Uploaded new Blob:
Then blob got deleted:
Output:
Also added some other new steps to be more accurate: Code view: