简体   繁体   中英

Automation script for applying lifecycle management to multiple Azure storage accounts in the same subscription

Hi I wanted to find out if there is a way to automate the process of creating a lifecycle management rule which moves base blobs to cool tier after 90 days and then after 30 days moves them to archive. I want to automate this for like 20 storage accounts in Azure. Is there a powershell script that can be run on a runbook in an automation account?

You should be able to adapt the sample in the documentation link here - https://learn.microsoft.com/en-us/powershell/module/az.storage/new-azstorageaccountmanagementpolicyrule?view=azps-6.3.0 . The first example creates a rule and applies it to an existing storage account.

If you're unsure what the rule JSON should look like, you can build a sample rule in the Azure portal and then look at the code view prior to saving the rule to download or view the json behind the rule.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM