Bylaw

Gallery › Health Data Services workspace › Azure built-in policies

Azure Health Data Services workspace should use private link

Converted Policy Audit Disabled Mode Indexed Version 1.0.0

Health Data Services workspace should have at least one approved private endpoint connection. Clients in a virtual network can securely access resources that have private endpoint connections through private links. For more information, visit: https://aka.ms/healthcareapisprivatelink.

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

Azure Policy JSONPrivateLink_Audit.json · 55 lines
{
  "properties": {
    "displayName": "Azure Health Data Services workspace should use private link",
    "policyType": "BuiltIn",
    "description": "Health Data Services workspace should have at least one approved private endpoint connection. Clients in a virtual network can securely access resources that have private endpoint connections through private links. For more information, visit: https://aka.ms/healthcareapisprivatelink.",
    "mode": "Indexed",
    "metadata": {
      "version": "1.0.0",
      "category": "Health Data Services workspace"
    },
    "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.HealthcareApis/workspaces"
          },
          {
            "count": {
              "field": "Microsoft.HealthcareApis/workspaces/privateEndpointConnections[*]",
              "where": {
                "field": "Microsoft.HealthcareApis/workspaces/privateEndpointConnections[*].privateLinkServiceConnectionState.status",
                "equals": "Approved"
              }
            },
            "less": 1
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/64528841-2f92-43f6-a137-d52e5c3dbeac",
  "name": "64528841-2f92-43f6-a137-d52e5c3dbeac"
}
Bylaw64528841-2f92-43f6-a137-d52e5c3dbeac.bylaw.ps1 · 30 lines
# Converted from PrivateLink_Audit.json by ConvertTo-Bylaw.
Policy '64528841-2f92-43f6-a137-d52e5c3dbeac' {

    Properties @{
        DisplayName   = 'Azure Health Data Services workspace should use private link'
        Description   = 'Health Data Services workspace should have at least one approved private endpoint connection. Clients in a virtual network can securely access resources that have private endpoint connections through private links. For more information, visit: https://aka.ms/healthcareapisprivatelink.'
        Version       = '1.0.0'
        Category      = 'Health Data Services workspace'
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.HealthcareApis/workspaces' {

        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/Health Data Services workspace/PrivateLink_Audit.json in Azure/azure-policy, under the MIT licence.