Hello Pratim Das, Partha C
Welcome to Microsoft Q&A, thanks for posting your query.
To facilitate the automation of Azure Storage Lifecycle Management rules for various containers within a storage account through a DevOps pipeline, the Below following steps can be implemented. This approach enables the application of designated lifecycle management rules to newly established containers while ensuring that existing containers remain unaffected.
- Ensure you have the lifecycle management rules defined. You can create a JSON file that contains the rules for each container.
- You can use Azure DevOps to create a pipeline that will apply these lifecycles management rules when a new container is created.
- Create a new pipeline in Azure DevOps.
- Choose the appropriate repository where your JSON file and scripts are stored.
- You can use Azure Event Grid to trigger your pipeline when a new container is created. Set up an Event Grid subscription for the storage account that listens for the
Microsoft.Storage.BlobCreated
event. - You can use Azure CLI or PowerShell to create a script that applies the lifecycle management rules to the newly created container
- Test Your Pipeline Create a new container in your Azure Storage Account. Verify that the Event Grid triggers the pipeline. Check that the appropriate lifecycle management rule is applied to the new container without affecting existing containers.
- Monitor the pipeline runs to ensure that lifecycle management rules are being applied correctly.
- Update your scripts and rules as needed based on changes in requirements.
Please let us know if you have any further queries. I’m happy to assist you further.
Please do consider to “up-vote” wherever the information provided helps you, this can be beneficial to other community members.