Is there a way to define a policy in an Azure subscription that will block the creation of any virtual machine with a cost above a certain amount? I have tried defining a policy that whitelists or blacklists individual SKU's, but it's tedious to maintain, to say the least.
CodePudding user response:
Is there a way to define a policy in an Azure subscription that will block the creation of any virtual machine with a cost above a certain amount?
In Azure Policy, there are several built-in policies that are available by default. For example:
- Allowed Storage Account SKUs
- Allowed Resource Type
- Allowed Locations
- Allowed Virtual Machine SKUs
- Add a tag to resources
- Not allowed resource types
And the below are the recommended policies for VM's:
You can Create a Custom policy definition that allows to define their own rules for using Azure like below:
Example:
Each storage account must be enabled for HTTPS
Each storage account must be disabled for HTTP.
Refer this link for more info about creating custom policies.
But there is no way to define a policy in an Azure subscription that will block the creation of any virtual machine with a cost above a certain amount.