Bylaw

Gallery › Decommissioned › Azure Landing Zones Library

Enforce policies in the Decommissioned Landing Zone

Converted Initiative Version 1.1.0

Enforce policies in the Decommissioned Landing Zone.

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

Azure Policy JSONEnforce-ALZ-Decomm.alz_policy_set_definition.json · 50 lines
{
  "name": "Enforce-ALZ-Decomm",
  "properties": {
    "description": "Enforce policies in the Decommissioned Landing Zone.",
    "displayName": "Enforce policies in the Decommissioned Landing Zone",
    "metadata": {
      "alzCloudEnvironments": [
        "AzureCloud",
        "AzureChinaCloud",
        "AzureUSGovernment"
      ],
      "category": "Decommissioned",
      "source": "https://github.com/Azure/Enterprise-Scale/",
      "version": "1.1.0"
    },
    "parameters": {
      "listOfResourceTypesAllowed": {
        "defaultValue": [],
        "metadata": {
          "description": "Allowed resource types in the Decommissioned landing zone, default is none.",
          "displayName": "Allowed resource types in the Decommissioned landing zone",
          "strongType": "resourceTypes"
        },
        "type": "Array"
      }
    },
    "policyDefinitions": [
      {
        "definitionVersion": "1.*.*",
        "groupNames": [],
        "parameters": {
          "listOfResourceTypesAllowed": {
            "value": "[parameters('listOfResourceTypesAllowed')]"
          }
        },
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/a08ec900-254a-4555-9bf5-e42af04b5c5c",
        "policyDefinitionReferenceId": "DecomDenyResources"
      },
      {
        "definitionVersion": "1.*.*",
        "groupNames": [],
        "parameters": {},
        "policyDefinitionId": "/providers/Microsoft.Management/managementGroups/contoso/providers/Microsoft.Authorization/policyDefinitions/Deploy-Vm-autoShutdown",
        "policyDefinitionReferenceId": "DecomShutdownMachines"
      }
    ],
    "policyType": "Custom"
  },
  "type": "Microsoft.Authorization/policySetDefinitions"
}
BylawEnforce-ALZ-Decomm.bylaw.ps1 · 34 lines
# Converted from Enforce-ALZ-Decomm.alz_policy_set_definition.json by ConvertTo-Bylaw.
Initiative 'Enforce-ALZ-Decomm' {

    Properties @{
        DisplayName = 'Enforce policies in the Decommissioned Landing Zone'
        Description = 'Enforce policies in the Decommissioned Landing Zone.'
        Category    = 'Decommissioned'
        Version     = '1.1.0'
        Metadata    = [ordered]@{ alzCloudEnvironments = @('AzureCloud', 'AzureChinaCloud', 'AzureUSGovernment'); source = 'https://github.com/Azure/Enterprise-Scale/' }
    }

    Parameter ListOfResourceTypesAllowed @{
        Type        = 'Array'
        Default     = @()
        DisplayName = 'Allowed resource types in the Decommissioned landing zone'
        Description = 'Allowed resource types in the Decommissioned landing zone, default is none.'
        Metadata    = [ordered]@{ strongType = 'resourceTypes' }
    }

    PolicyDefinition @{
        Id          = 'a08ec900-254a-4555-9bf5-e42af04b5c5c'
        ReferenceId = 'DecomDenyResources'
        Version     = '1.*.*'
        Parameters  = @{
            listOfResourceTypesAllowed = (Param ListOfResourceTypesAllowed)
        }
    }

    PolicyDefinition @{
        Id          = '/providers/Microsoft.Management/managementGroups/contoso/providers/Microsoft.Authorization/policyDefinitions/Deploy-Vm-autoShutdown'
        ReferenceId = 'DecomShutdownMachines'
        Version     = '1.*.*'
    }
}

Members (2)

Source: policy_set_definitions/Enforce-ALZ-Decomm.alz_policy_set_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.