Bylaw

Gallery › General › Azure built-in policies

[Deprecated]: Allow resource creation only in European data centers

Converted Policy Deny Mode Indexed Version 1.0.0-deprecated Deprecated

Allows resource creation in the following locations only: North Europe, West Europe

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

Azure Policy JSONEuropeanRegionsOnly_Deny.json · 34 lines
{
  "properties": {
    "displayName": "[Deprecated]: Allow resource creation only in European data centers",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Allows resource creation in the following locations only: North Europe, West Europe",
    "metadata": {
      "version": "1.0.0-deprecated",
      "category": "General",
      "deprecated": true
    },
    "version": "1.0.0",
    "parameters": {},
    "policyRule": {
      "if": {
        "not": {
          "field": "location",
          "in": [
            "northeurope",
            "westeurope"
          ]
        }
      },
      "then": {
        "effect": "Deny"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/94c19f19-8192-48cd-a11b-e37099d3e36b",
  "name": "94c19f19-8192-48cd-a11b-e37099d3e36b"
}
Bylaw94c19f19-8192-48cd-a11b-e37099d3e36b.bylaw.ps1 · 22 lines
# Converted from EuropeanRegionsOnly_Deny.json by ConvertTo-Bylaw.
Policy '94c19f19-8192-48cd-a11b-e37099d3e36b' {

    Properties @{
        DisplayName   = '[Deprecated]: Allow resource creation only in European data centers'
        Description   = 'Allows resource creation in the following locations only: North Europe, West Europe'
        Version       = '1.0.0-deprecated'
        Category      = 'General'
        Deprecated    = $true
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

    Resource * {

        Require 'location is one of 2 values' {
            Field location | Must -BeIn @('northeurope', 'westeurope')
        }
    }

    Effect Deny
}

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