Azure policy in action : preventing type resources from being created

Let's say you do not want certain resources to be created. This can be controlled via Azure policy and can be scope to subscription or resource group level.

We will prevent storage account from being created in a resource group and here is how we can do it. First goto Azure Policy - Authoring - Definition and look for 'Not allowed resource types'. 


Then click on "Assign Policy" and for my test, I will scope this to Resource group level.


And then provide a name to it like so,



Next, is where we specify "Resource Type" - let's select storageAccounts and then click on "Next". 




And now if you switch over to "Assignments", you will notice your policy gets created. 




Now it is time for test out your policy by creating a storage account in myfdrydev-rg. And then you will be hit with an error.








Comments

Popular posts from this blog

Windows SSH: Permissions for 'private-key' are too open

NodeJS: Error: spawn EINVAL in window for node version 20.20 and 18.20