Bylaw

Gallery › ElasticSan › Azure built-in policies

ElasticSan should disable public network access

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0

Disable public network access for your ElasticSan so that it's not accessible over the public internet. This can reduce data leakage risks.

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

Azure Policy JSONPublicNetworkAccess_Audit.json · 50 lines
{
  "properties": {
    "displayName": "ElasticSan should disable public network access",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Disable public network access for your ElasticSan so that it's not accessible over the public internet. This can reduce data leakage risks.",
    "metadata": {
      "version": "1.0.0",
      "category": "ElasticSan"
    },
    "version": "1.0.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.ElasticSan/elasticSans"
          },
          {
            "field": "Microsoft.ElasticSan/elasticSans/publicNetworkAccess",
            "notEquals": "Disabled"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/6a92fe1f-0b86-44ae-843d-2db3d2b571ae",
  "name": "6a92fe1f-0b86-44ae-843d-2db3d2b571ae"
}
Bylaw6a92fe1f-0b86-44ae-843d-2db3d2b571ae.bylaw.ps1 · 28 lines
# Converted from PublicNetworkAccess_Audit.json by ConvertTo-Bylaw.
Policy '6a92fe1f-0b86-44ae-843d-2db3d2b571ae' {

    Properties @{
        DisplayName   = 'ElasticSan should disable public network access'
        Description   = 'Disable public network access for your ElasticSan so that it''s not accessible over the public internet. This can reduce data leakage risks.'
        Version       = '1.0.0'
        Category      = 'ElasticSan'
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.ElasticSan/elasticSans' {

        Require 'publicNetworkAccess is Disabled' {
            Field publicNetworkAccess | Must -Be 'Disabled'
        }
    }

    Effect (Param Effect)
}

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