Bylaw

Gallery › Cost Control › Azure Community Policy

Allowed SKUs for Storage Accounts and Virtual Machines

Converted Initiative

This policy allows you to specify what skus are allowed for storage accounts and virtual machines

ConvertTo-Bylaw converted this initiative, and proved that the file compiles back to the same definition.

Azure Policy JSONazurepolicyset.json · 43 lines
{
   "properties": {
      "displayName": "Allowed SKUs for Storage Accounts and Virtual Machines",
      "description": "This policy allows you to specify what skus are allowed for storage accounts and virtual machines",
      "parameters": {
         "LISTOFALLOWEDSKUS_1": {
            "type": "Array",
            "metadata": {
               "displayName": "VM SKUs",
               "strongType": "vmSKUs"
            }
         },
         "LISTOFALLOWEDSKUS_2": {
            "type": "Array",
            "metadata": {
               "displayName": "Storage Account SKUs",
               "strongType": "storageSkus"
            }
         }
      },
      "policyDefinitions": [
         {
            "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/cccc23c7-8427-4f53-ad12-b6a63eb452b3",
            "parameters": {
               "listOfAllowedSKUs": {
                  "value": "[parameters('LISTOFALLOWEDSKUS_1')]"
               }
            }
         },
         {
            "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1",
            "parameters": {
               "listOfAllowedSKUs": {
                  "value": "[parameters('LISTOFALLOWEDSKUS_2')]"
               }
            }
         }
      ],
      "metadata": {
         "category": "Cost Control"
      }
   }
}
Bylawazurepolicyset.bylaw.ps1 · 38 lines
# Converted from azurepolicyset.json by ConvertTo-Bylaw.
Initiative 'azurepolicyset' {

    Properties @{
        DisplayName = 'Allowed SKUs for Storage Accounts and Virtual Machines'
        Description = 'This policy allows you to specify what skus are allowed for storage accounts and virtual machines'
        Category    = 'Cost Control'
    }

    Parameter LISTOFALLOWEDSKUS_1 @{
        Type        = 'Array'
        DisplayName = 'VM SKUs'
        JsonName    = 'LISTOFALLOWEDSKUS_1'
        Metadata    = [ordered]@{ strongType = 'vmSKUs' }
    }
    Parameter LISTOFALLOWEDSKUS_2 @{
        Type        = 'Array'
        DisplayName = 'Storage Account SKUs'
        JsonName    = 'LISTOFALLOWEDSKUS_2'
        Metadata    = [ordered]@{ strongType = 'storageSkus' }
    }

    PolicyDefinition @{
        Id          = 'cccc23c7-8427-4f53-ad12-b6a63eb452b3'
        ReferenceId = 'cccc23c7-8427-4f53-ad12-b6a63eb452b3'
        Parameters  = @{
            listOfAllowedSKUs = (Param LISTOFALLOWEDSKUS_1)
        }
    }

    PolicyDefinition @{
        Id          = '7433c107-6db4-4ad1-b57a-a76dce0154a1'
        ReferenceId = '7433c107-6db4-4ad1-b57a-a76dce0154a1'
        Parameters  = @{
            listOfAllowedSKUs = (Param LISTOFALLOWEDSKUS_2)
        }
    }
}

Members (2)

Source: policySetDefinitions/skus-for-multiple-types/azurepolicyset.json in Azure/Community-Policy, under the MIT licence.