How to limit the size of a virtual machine using Azure RBAC?

As an administrator, I need to limit the size of virtual machines that my end users can provide through the Azure portal. I'm looking for something similar to what I can do with AWS IAM, make sure that users can only provide specific sizes of virtual machines.

+4
source share
2 answers

Garuav nailed it - you want to use a policy definition.

https://azure.microsoft.com/en-us/documentation/articles/resource-manager-policy/

You will have something like this:

$policyJSON = @'
    {
      "if" : {
      "not" : {
        "field" : "vmSize",
        "in" : ["Standard_D1", "Standard_D2"]
      }
    },
      "then" : {
        "effect" : "deny"
      }
    }
'@

$policy = New-AzureRmPolicyDefinition -Name 'VMSizeRestriction' -DisplayName 'VM Size Restrictions' -Policy $policyJSON

New-AzureRmPolicyAssignment -Name 'VMSizeRestriction-SubscriptionA' -PolicyDefinition $policy -Scope '/subscriptions/########-####-####-####-############'

(, resourceGroups) RBAC ( RG, RG). doc .

+2

Vms, , " Azure Dev" vm, . RBAC dev.

enter image description here

- ressource .

,

+1

Source: https://habr.com/ru/post/1650644/


All Articles