Custom Azure Policy to Limit VM's in Resource Group

%3CLINGO-SUB%20id%3D%22lingo-sub-159438%22%20slang%3D%22en-US%22%3ECustom%20Azure%20Policy%20to%20Limit%20VM's%20in%20Resource%20Group%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-159438%22%20slang%3D%22en-US%22%3E%3CP%3EWe%20are%20looking%20for%20a%20way%20to%20limit%20the%20number%20of%20VM's%20that%20a%20resource%20group%20can%20create.%26nbsp%3B%20There%20is%20a%20policy%20built%20in%20where%20you%20can%20limit%20the%20type%2C%20but%20not%20the%20amount.%26nbsp%3B%20The%20goal%20is%20to%20create%20groups%20where%20students%20can%20create%20VM's%2C%20but%20we%20don't%20wan%20them%20to%20be%20able%20to%20create%20more%20than%2010%20new%20VM's%20in%20their%20resource%20group.%26nbsp%3B%20It%20looks%20like%20we%20could%20create%20a%20custom%20policy%20to%20do%20this%2C%20but%20wondering%20if%20anyone%20has%20done%20this%20before%20and%20can%20share%20the%20JSON%20code%20for%20that%20policy%20or%20if%20you%20can%20think%20of%20a%20better%20way%20to%20do%20it.%26nbsp%3B%20Thank%20you!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-159438%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20Resource%20Management%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMonitoring%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Visitor

We are looking for a way to limit the number of VM's that a resource group can create.  There is a policy built in where you can limit the type, but not the amount.  The goal is to create groups where students can create VM's, but we don't wan them to be able to create more than 10 new VM's in their resource group.  It looks like we could create a custom policy to do this, but wondering if anyone has done this before and can share the JSON code for that policy or if you can think of a better way to do it.  Thank you!

0 Replies