Deleting automatically created containers in storage account(adls gen2)

Rohit Boddu 466 Reputation points
2020-10-13T13:24:27.203+00:00

Hi,

I have deployed one storage account(adls gen2).

Whenever any automated jobs run its output is stored in adls and these are stored in containers which are automatically created. Containers created are in this pattern "f4082jd-bdbjdbk-nkfk-nhkdk-5974bhsk".

i have requirement like deleting this automated containers which are older than specified days.

how i can i do this task using azure data factory.

i dont want to use powershell script or python script and dont want to use batch account.

Regards,
Rohit.

Azure Data Lake Storage
Azure Data Lake Storage
An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
1,471 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,693 questions
0 comments No comments
{count} votes

Accepted answer
  1. HarithaMaddi-MSFT 10,136 Reputation points
    2020-10-14T18:13:12.317+00:00

    Hi @Rohit Boddu ,

    Welcome to Microsoft Q&A Platform. Thanks for posting the query.

    I used below approach to implement this requirement in azure data factory. Using "Get Metadata", "Foreach", "IF Condition" and "delete" activities this can be achieved. Below GIF shows the details, for testing, I deleted container less than 10days age by using delete activity in false activity of "IF Condition", the same can be used in true condition for greater than 10days containers.

    IF Condition Expression used:

    @greaterOrEquals(div(sub(int(ticks(utcnow())),int(ticks(activity('Get Metadata2').output.lastModified))),864000000000),10)  
    

    32422-deletecontainersbyageadf.gif

    Hope this helps! Please let us know for further queries and we will be glad to assist.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.