Blue Clouds
Blue Clouds

Reputation: 8161

Azure Resource Lock through policy but delete through DevOps

In this link a policy to lock resource group is given. Once it is implemented I would like the Devops pipeline to delete resources(as part of re-creation). I do not want the policy to prevent me from doing this(or temporarily allow me). How can I do it? As soon as the devops is done, Policy should act on this newly created object to lock it again.

Upvotes: 0

Views: 793

Answers (1)

Shiraz Bhaiji
Shiraz Bhaiji

Reputation: 65461

Assuming that you have used 'deployIfNotExists', if you remove the lock the policy will put the lock on again.

Therefore the devops pipline must:

  • Disable the policy
  • Remove the lock from the resources that need to be recreated
  • Recreate the resource
  • Enable the policy

Upvotes: 0

Related Questions