Bylaw

Gallery › General › Azure built-in policies

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

Converted Policy Deny Mode Indexed Version 1.0.0-deprecated Deprecated

Allows resource creation in the following locations only: West India, South India, Central India

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

Azure Policy JSONIndiaRegionsOnly_Deny.json · 35 lines
{
  "properties": {
    "displayName": "[Deprecated]: Allow resource creation only in India data centers",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Allows resource creation in the following locations only: West India, South India, Central India",
    "metadata": {
      "version": "1.0.0-deprecated",
      "category": "General",
      "deprecated": true
    },
    "version": "1.0.0",
    "parameters": {},
    "policyRule": {
      "if": {
        "not": {
          "field": "location",
          "in": [
            "westindia",
            "southindia",
            "centralindia"
          ]
        }
      },
      "then": {
        "effect": "Deny"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/5ee85ce5-e7eb-44d6-b4a2-32a24be1ca54",
  "name": "5ee85ce5-e7eb-44d6-b4a2-32a24be1ca54"
}
Bylaw5ee85ce5-e7eb-44d6-b4a2-32a24be1ca54.bylaw.ps1 · 22 lines
# Converted from IndiaRegionsOnly_Deny.json by ConvertTo-Bylaw.
Policy '5ee85ce5-e7eb-44d6-b4a2-32a24be1ca54' {

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

    Resource * {

        Require 'location is one of 3 values' {
            Field location | Must -BeIn @('westindia', 'southindia', 'centralindia')
        }
    }

    Effect Deny
}

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