Background:
Many times, we have a requirement to delete the page blobs automatically after certain period of times from the Storage account as currently Lifecyle management does not support Page blob deletion
Note: we can delete All blobs (Page/Block/Append blob) from the ADF
Deletion of page blobs (or any blob type) from the storage account can be achieved using Azure Storage explorer, REST API, SDK’s, PowerShell, Azure Data Factory, Azure logic App, Azure Function app, Azure storage actions (Preview) etc.
This blog shows how to use ADF to delete blobs.
Step 1:
Create an azure data factory resource from azure portal. If you are new to ADF, please refer this link on how to create one: https://docs.microsoft.com/en-us/azure/data-factory/quickstart-create-data-factory-portal
Step 2:
From the overview blade, select 'Open Azure Data Factory Studio'.
Step 3:
On the data factory portal click on the pen item -> + > Create pipeline
Step 4:
Click on the Pipeline that has been created -> Under Activities -> General-> select ‘Delete’ and drag it to the pipeline area.
Step 5:
Under Source -> Select New. For Datasource =-> choose Azure Blob Storage
Step 6:
In the New linked service, you can use the name that is by default or customize as per requirement
If the account selection method is azure subscription you can choose the storage account, else you can enter manually too.
Then click on ‘Create’
Step 7:
In the file path: enter the container and folder/Directory name (according to your requirement)
Step 8:
Returning to the pipeline, you can configure the following properties as depicted in the image:
Note: If you would like to delete only blobs based on last modified you can use "Filter by last Modified" option
Step 9 :
Click on Debug, to run the pipeline:
We can validate the pipeline activity in the output tab
Note:
Use Add Trigger to manually start the pipeline.
Use Add Trigger to schedule the pipeline.
References: