DEV Community

Cover image for Creating, testing and Deleting Policies
Jetsumz
Jetsumz

Posted on

Creating, testing and Deleting Policies

  1. Search for 'policy' in the search menu bar on azure portal.
    Image description

  2. Select the 'assignments' blade.
    Image description

  3. Select Assign Policy.
    Image description

  4. Define the Policy then add. For this tutorial we'll be creating a policy that requires resources to have a Tag.
    Image description

  5. You can optionally add exclusions and create a description for the policy.
    Image description

  6. Set Tag name and Value in parameters.
    Image description

  7. Create the Policy.
    Image description

  8. It should look similar to the image below if successful.
    Image description

  9. Let us test the Policy created by creating a storage account.
    Image description

  10. I will purposefully omit the assigning of tag in the storage account to test if the Policy will work.
    Image description

  11. As shown below, the Policy prevents the storage account from being deployed because it does not have the specified tag.
    Image description

  12. Now I will try to create the storage account again but this time I will include the Tag.
    Image description

  13. As shown below, the deployment of the storage account was successful.
    Image description

  14. To delete the Policy, simply go back to the policy created in the 'assignments' blade and click delete assignment from the drop down.
    Image description

Top comments (0)