Bylaw

Gallery › ElasticSan › Azure built-in policies

ElasticSan Volume Group should use private endpoints

Converted Policy Audit Disabled Mode All Version 1.0.0

Private endpoints lets administrator connect virtual networks to Azure services without a public IP address at the source or destination. By mapping private endpoints to volume group, administrator can reduce data leakage risks

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

Azure Policy JSONVolumeGroup_PrivateEndpoints_Audit.json · 55 lines
{
  "properties": {
    "displayName": "ElasticSan Volume Group should use private endpoints",
    "policyType": "BuiltIn",
    "mode": "All",
    "description": "Private endpoints lets administrator connect virtual networks to Azure services without a public IP address at the source or destination. By mapping private endpoints to volume group, administrator 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",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.ElasticSan/elasticSans/volumeGroups"
          },
          {
            "count": {
              "field": "Microsoft.ElasticSan/elasticSans/volumeGroups/privateEndpointConnections[*]",
              "where": {
                "field": "Microsoft.ElasticSan/elasticSans/volumeGroups/privateEndpointConnections[*].privateLinkServiceConnectionState.status",
                "equals": "Approved"
              }
            },
            "less": 1
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/1abc5157-29f8-4dbd-b28e-ff99526cb8b7",
  "name": "1abc5157-29f8-4dbd-b28e-ff99526cb8b7"
}
Bylaw1abc5157-29f8-4dbd-b28e-ff99526cb8b7.bylaw.ps1 · 30 lines
# Converted from VolumeGroup_PrivateEndpoints_Audit.json by ConvertTo-Bylaw.
Policy '1abc5157-29f8-4dbd-b28e-ff99526cb8b7' {

    Properties @{
        DisplayName   = 'ElasticSan Volume Group should use private endpoints'
        Description   = 'Private endpoints lets administrator connect virtual networks to Azure services without a public IP address at the source or destination. By mapping private endpoints to volume group, administrator can reduce data leakage risks'
        Version       = '1.0.0'
        Category      = 'ElasticSan'
        PolicyVersion = '1.0.0'
        Mode          = 'All'
    }

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

    Resource 'Microsoft.ElasticSan/elasticSans/volumeGroups' {

        Require 'privateEndpointConnections and privateLinkServiceConnectionState.status are as required' {
            Count 'privateEndpointConnections[*]' -Where {
                Field privateLinkServiceConnectionState.status | Must -Be 'Approved'
            } | Must -BeGreaterOrEqual 1
        }
    }

    Effect (Param Effect)
}

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