lifecycle policy powershell issue

Gary Leow 21 Reputation points
2020-08-25T02:03:46.413+00:00

Hi,

I'm would like to ask I did ran the sample powershell script that provided in the following link. So it works to create the lifecycle policy to one of my container part under for my storage account but when i re-apply the script to the same storage account to different container, it will removed the existing lifecycle policy and add-in the new one.

Could you advice how do i apply the powershell script without removing the existing policy??

https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/storage/blobs/storage-lifecycle-management-concepts.md

Regards,
Gary

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,220 questions
0 comments No comments
{count} votes

Accepted answer
  1. deherman-MSFT 37,416 Reputation points Microsoft Employee
    2020-08-25T21:14:06.29+00:00

    @Gary Leow
    The only way to update a policy currently with PowerShell is running Set-AzStorageAccountManagementPolicy. This will override any existing rules you had in place so you will need to include your old rules. The easiest way would be to take the current JSON of your policy and add the rules there. You can also easily add a rule or view the current JSON of your rules in the Portal.

    I understand this is probably not as easy as it could be and have submitted feedback to the product team on this. I hope the information I provided was helpful. Please let us know if you have further questions or issues and we will be happy to assist.

    -----------------

    Please don’t forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.


1 additional answer

Sort by: Most helpful
  1. Gary Leow 21 Reputation points
    2020-09-23T09:20:54.4+00:00

    Apology for late response.

    Could you please let us know if Microsoft found a way to apply the lifecycle management policy without overridden the old policy via powershell.

    0 comments No comments

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.