Bylaw

Gallery › General › Azure Community Policy

Deny Fabric Capacity creations

Converted Policy Audit Deny Disabled Mode all Version 1.0.0

This policy prevents or audits the creation of fabric capacity resources to enhance governance whenever needed

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

Azure Policy JSONazurepolicy.json · 37 lines
{
    "name": "f20fb0b9-f5bb-4a0d-ab8f-f9c28bf16746",
    "type": "Microsoft.Authorization/policyDefinitions",
    "properties": {
      "displayName": "Deny Fabric Capacity creations",
      "description": "This policy prevents or audits the creation of fabric capacity resources to enhance governance whenever needed",
      "metadata": {
        "category": "General",
        "version": "1.0.0"
      },
      "mode": "all",
      "parameters": {
        "effect": {
          "type": "String",
          "metadata": {
            "displayName": "Effect",
            "description": "Deny, Audit or Disabled the execution of the Policy"
          },
          "allowedValues": [
            "Deny",
            "Audit",
            "Disabled"
          ],
          "defaultValue": "Audit"
        }
      },
      "policyRule": {
        "if": {
          "field": "type",
          "like": "Microsoft.Fabric/capacities*"
        },
        "then": {
          "effect": "[parameters('effect')]"
        }
      }
    }
  }
Bylawf20fb0b9-f5bb-4a0d-ab8f-f9c28bf16746.bylaw.ps1 · 27 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy 'f20fb0b9-f5bb-4a0d-ab8f-f9c28bf16746' {

    Properties @{
        DisplayName = 'Deny Fabric Capacity creations'
        Description = 'This policy prevents or audits the creation of fabric capacity resources to enhance governance whenever needed'
        Category    = 'General'
        Version     = '1.0.0'
        Mode        = 'All'
    }

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

    Resource * {

        Require 'type is not like Microsoft.Fabric/capacities*' {
            Field type | Must -Not -BeLike 'Microsoft.Fabric/capacities*' -IfPresent
        }
    }

    Effect (Param Effect)
}

Source: policyDefinitions/General/deny-fabric-capacity-creation/azurepolicy.json in Azure/Community-Policy, under the MIT licence.