Bylaw

Gallery › General › Azure built-in policies

[Deprecated]: Allow resource creation only in United States data centers

Converted Policy Deny Mode Indexed Version 1.0.0-deprecated Deprecated

Allows resource creation in the following locations only: Central US, East US, East US2, North Central US, South Central US, West US

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

Azure Policy JSONUSRegionsOnly_Deny.json · 38 lines
{
  "properties": {
    "displayName": "[Deprecated]: Allow resource creation only in United States data centers",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Allows resource creation in the following locations only: Central US, East US, East US2, North Central US, South Central US, West US",
    "metadata": {
      "version": "1.0.0-deprecated",
      "category": "General",
      "deprecated": true
    },
    "version": "1.0.0",
    "parameters": {},
    "policyRule": {
      "if": {
        "not": {
          "field": "location",
          "in": [
            "centralus",
            "eastus",
            "eastus2",
            "northcentralus",
            "southcentralus",
            "westus"
          ]
        }
      },
      "then": {
        "effect": "Deny"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/983211ba-f348-4758-983b-21fa29294869",
  "name": "983211ba-f348-4758-983b-21fa29294869"
}
Bylaw983211ba-f348-4758-983b-21fa29294869.bylaw.ps1 · 22 lines
# Converted from USRegionsOnly_Deny.json by ConvertTo-Bylaw.
Policy '983211ba-f348-4758-983b-21fa29294869' {

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

    Resource * {

        Require 'location is one of 6 values' {
            Field location | Must -BeIn @('centralus', 'eastus', 'eastus2', 'northcentralus', 'southcentralus', 'westus')
        }
    }

    Effect Deny
}

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