Bylaw

Gallery › Managed Grafana › Azure built-in policies

Azure Managed Grafana workspaces should disable Grafana Enterprise upgrade

Converted Policy Audit Deny Disabled Mode Indexed Version 1.1.0

Disables Grafana Enterprise upgrade in Grafana workspace.

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

Azure Policy JSONAMG_Enterprise_Deny.json · 51 lines
{
  "properties": {
    "displayName": "Azure Managed Grafana workspaces should disable Grafana Enterprise upgrade",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Disables Grafana Enterprise upgrade in Grafana workspace.",
    "metadata": {
      "version": "1.1.0",
      "category": "Managed Grafana"
    },
    "version": "1.1.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Dashboard/grafana"
          },
          {
            "field": "Microsoft.Dashboard/grafana/enterpriseConfigurations",
            "exists": true
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.1.0",
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/a08f2347-fe9c-482b-a944-f6a0e05124c0",
  "name": "a08f2347-fe9c-482b-a944-f6a0e05124c0"
}
Bylawa08f2347-fe9c-482b-a944-f6a0e05124c0.bylaw.ps1 · 28 lines
# Converted from AMG_Enterprise_Deny.json by ConvertTo-Bylaw.
Policy 'a08f2347-fe9c-482b-a944-f6a0e05124c0' {

    Properties @{
        DisplayName   = 'Azure Managed Grafana workspaces should disable Grafana Enterprise upgrade'
        Description   = 'Disables Grafana Enterprise upgrade in Grafana workspace.'
        Version       = '1.1.0'
        Category      = 'Managed Grafana'
        PolicyVersion = '1.1.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.Dashboard/grafana' {

        Require 'enterpriseConfigurations does not exist' {
            Field enterpriseConfigurations | Must -Not -Exist
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Managed Grafana/AMG_Enterprise_Deny.json in Azure/azure-policy, under the MIT licence.