How To Implement Allowed Virtual Machine Size SKUs Policy In Azure

Introduction

You may manage which VM sizes can be installed in your environment using Azure Policy, as well as which sizes are prohibited by omission. This Deny policy will prevent VMs from being created with or resized to any instance that is not stated in your policy. The instance sizes are known as SKUs (stock keeping units).

This article demonstrates how to set up allowed virtual machine size SKUs policy that restricts the deployment of your virtual machines based on Standard_B20ms and Standard_B2ms sizes only.

Step 1

Go to your subscription and select Policies under Settings.

How to implement Allowed virtual machine size SKUs policy in Azure

Step 2

Go to Assign policy under Assignments.

How to implement Allowed virtual machine size SKUs policy in Azure

Step 3

Select the correct scope.

How to implement Allowed virtual machine size SKUs policy in Azure

In Policy definitions, search for Allowed virtual machine size SKUs.

How to implement Allowed virtual machine size SKUs policy in Azure

Step 4

You can provide a Description if you want. Then click on Next button.

How to implement Allowed virtual machine size SKUs policy in Azure

Step 5

In the Parameters tab, select the desired sizes and click on Next button.

How to implement Allowed virtual machine size SKUs policy in Azure

Step 6

You can add a Non-compliance message under Non-compliance messages tab. Then click on Review + create.

How to implement Allowed virtual machine size SKUs policy in Azure

Step 7

Click on Create button. You will be able to see the created policy in the list.

How to implement Allowed virtual machine size SKUs policy in Azure

Step 8

After adding the policy, when you are trying to create a VM you will see a notification like below:

How to implement Allowed virtual machine size SKUs policy in Azure

When you try to select a size for your VM, you will be displayed a list of available sizes and a list od sized blocked by the policy. You won’t be able to select the sized under Blocked by Policy list.

How to implement Allowed virtual machine size SKUs policy in Azure

Summary

In this article, you learned how to implement an allowed virtual machine size SKUs policy in Azure. Please use the comments section if you have any clarification.