Share via

Select Parameter value based on subscription

pgaddam 151 Reputation points
2022-06-17T16:15:40.867+00:00

While deploying an SQL VM through ARM template; I have a parameter (sku) to allow values DEV, ENTERPRISE & STANDARD editions. I want to control these values when the deployment is happening for instance: I want to use ENTERRPISE or Standard in Prod subscription and DEV in all other subscriptions. Is there a way to restrict the parameter usage in subscriptions?

SQL Server on Azure Virtual Machines
Azure Policy
Azure Policy

An Azure service that is used to implement corporate governance and standards at scale for Azure resources.

0 comments No comments

Answer accepted by question author

AnuragSingh-MSFT 21,566 Reputation points Moderator
2022-06-20T12:05:31.75+00:00

@Pranith-3606, thank you for reaching out to Microsoft Q&A for this question.

Using Azure Policy, you can follow the steps below to achieve it:

1. If all the Subscriptions are contained within the same Management Group, you may create a policy and save it in that Management Group and assign it to individual subscription based on your requirement. However, if the subscriptions are not contained within the same Management Group, you would have to store the Azure Policy in each subscription.

2. The Azure Policy could contain logic to restrict the size/sku of resource. For example, you may refer to this built-in Azure Policy which restricts the VM SKUs - Allowed virtual machine size SKUs

3. Depending on what is allowed, respective sizes could be selected, and the Policy is assigned to the subscription.

Note that this will cause the resource creation to fail after submission. However, it will not restrict user from selecting the particular Size/SKU in template/parameter.

Please let me know if you have any questions.

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.