Bylaw

Gallery › General › Azure built-in policies

Allow Usage Cost Resources

Converted Initiative Version 1.0.0

Allow resources to be deployed except MCPP, M365.

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

Azure Policy JSONAllowUsageCosts.json · 54 lines
{
  "properties": {
    "displayName": "Allow Usage Cost Resources",
    "policyType": "BuiltIn",
    "description": "Allow resources to be deployed except MCPP, M365.",
    "metadata": {
      "version": "1.0.0",
      "category": "General"
    },
    "Version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Deny"
      }
    },
    "policyDefinitions": [
      {
        "policyDefinitionReferenceId": "NotAllowM365_Deny",
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/176b7c36-ac64-4f15-a296-50bd7fafab12",
        "definitionVersion": "1.*.*",
        "parameters": {
          "effect": {
            "value": "[parameters('effect')]"
          }
        }
      },
      {
        "policyDefinitionReferenceId": "NotAllowMCPP_Deny",
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/335d919a-dc24-4a94-b7cb-9f81b1a8156f",
        "definitionVersion": "1.*.*",
        "parameters": {
          "effect": {
            "value": "[parameters('effect')]"
          }
        }
      }
    ],
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policySetDefinitions/0a2ebd47-3fb9-4735-a006-b7f31ddadd9f",
  "name": "0a2ebd47-3fb9-4735-a006-b7f31ddadd9f"
}
Bylaw0a2ebd47-3fb9-4735-a006-b7f31ddadd9f.bylaw.ps1 · 36 lines
# Converted from AllowUsageCosts.json by ConvertTo-Bylaw.
Initiative '0a2ebd47-3fb9-4735-a006-b7f31ddadd9f' {

    Properties @{
        DisplayName   = 'Allow Usage Cost Resources'
        Description   = 'Allow resources to be deployed except MCPP, M365.'
        Version       = '1.0.0'
        Category      = 'General'
        PolicyVersion = '1.0.0'
    }

    Parameter Effect @{
        AllowedValues = @('Audit', 'Deny', 'Disabled')
        Default       = 'Deny'
        DisplayName   = 'Effect'
        Description   = 'Enable or disable the execution of the policy'
    }

    PolicyDefinition @{
        Id          = '176b7c36-ac64-4f15-a296-50bd7fafab12'
        ReferenceId = 'NotAllowM365_Deny'
        Version     = '1.*.*'
        Parameters  = @{
            effect = (Param Effect)
        }
    }

    PolicyDefinition @{
        Id          = '335d919a-dc24-4a94-b7cb-9f81b1a8156f'
        ReferenceId = 'NotAllowMCPP_Deny'
        Version     = '1.*.*'
        Parameters  = @{
            effect = (Param Effect)
        }
    }
}

Members (2)

Source: built-in-policies/policySetDefinitions/General/AllowUsageCosts.json in Azure/azure-policy, under the MIT licence.