Bylaw

Gallery › Cache › Azure Community Policy

Azure Redis Cache should supports 'Standard replication'

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0

Use 'Standard replication' in order to have an a high availability architecture that ensures your managed instance is functioning, even when outages affect the underlying virtual machines (VMs)

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

Azure Policy JSONazurepolicy.json · 49 lines
{
  "name": "8fefe846-bf48-4882-a717-a451275655ef",
  "type": "Microsoft.Authorization/policyDefinitions",
  "properties": {
    "displayName": "Azure Redis Cache should supports 'Standard replication'",
    "description": "Use 'Standard replication' in order to have an a high availability architecture that ensures your managed instance is functioning, even when outages affect the underlying virtual machines (VMs)",
    "metadata": {
      "version": "1.0.0",
      "category": "Cache"
    },
    "mode": "Indexed",
    "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": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Cache/Redis"
          },
          {
            "field": "Microsoft.Cache/Redis/sku.family",
            "equals": "C"
          },
          {
            "field": "Microsoft.Cache/Redis/sku.name",
            "equals": "Basic"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    }
  }
}
Bylaw8fefe846-bf48-4882-a717-a451275655ef.bylaw.ps1 · 31 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '8fefe846-bf48-4882-a717-a451275655ef' {

    Properties @{
        DisplayName = 'Azure Redis Cache should supports ''Standard replication'''
        Description = 'Use ''Standard replication'' in order to have an a high availability architecture that ensures your managed instance is functioning, even when outages affect the underlying virtual machines (VMs)'
        Version     = '1.0.0'
        Category    = 'Cache'
        Mode        = 'Indexed'
    }

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

    Resource 'Microsoft.Cache/Redis' {

        When {
            Field sku.family | Must -Be 'C'
        }

        Require 'sku.name is not Basic' {
            Field sku.name | Must -Not -Be 'Basic' -IfPresent
        }
    }

    Effect (Param Effect)
}

Source: policyDefinitions/Cache/azure-redis-cache-should-supports-'standard-replication'/azurepolicy.json in Azure/Community-Policy, under the MIT licence.