Bylaw

Gallery › Sovereignty › Azure built-in policies

[Preview]: Azure Managed Redis should disable public network access

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0-preview Preview

Disabling public network access improves security by ensuring that Azure Managed Redis isn't exposed on the public internet. Configure a private endpoint before disabling public network access.

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

Azure Policy JSONRedisCacheEnterprise_PublicNetworkAccess_AuditDeny.json · 51 lines
{
  "properties": {
    "displayName": "[Preview]: Azure Managed Redis should disable public network access",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Disabling public network access improves security by ensuring that Azure Managed Redis isn't exposed on the public internet. Configure a private endpoint before disabling public network access.",
    "metadata": {
      "version": "1.0.0-preview",
      "category": "Sovereignty",
      "preview": true
    },
    "version": "1.0.0-preview",
    "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.Cache/redisEnterprise"
          },
          {
            "field": "Microsoft.Cache/redisEnterprise/publicNetworkAccess",
            "equals": "Enabled"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0-PREVIEW"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/0f8a6cc3-040f-4b9b-8828-b37490729517",
  "name": "0f8a6cc3-040f-4b9b-8828-b37490729517"
}
Bylaw0f8a6cc3-040f-4b9b-8828-b37490729517.bylaw.ps1 · 29 lines
# Converted from RedisCacheEnterprise_PublicNetworkAccess_AuditDeny.json by ConvertTo-Bylaw.
Policy '0f8a6cc3-040f-4b9b-8828-b37490729517' {

    Properties @{
        DisplayName   = '[Preview]: Azure Managed Redis should disable public network access'
        Description   = 'Disabling public network access improves security by ensuring that Azure Managed Redis isn''t exposed on the public internet. Configure a private endpoint before disabling public network access.'
        Version       = '1.0.0-preview'
        Category      = 'Sovereignty'
        Preview       = $true
        PolicyVersion = '1.0.0-preview'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.Cache/redisEnterprise' {

        Require 'publicNetworkAccess is not Enabled' {
            Field publicNetworkAccess | Must -Not -Be 'Enabled' -IfPresent
        }
    }

    Effect (Param Effect)
}

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