Bylaw

Gallery › API for FHIR › Azure built-in policies

Azure API for FHIR should use a customer-managed key to encrypt data at rest

Converted Policy Audit Disabled Mode Indexed Version 1.1.0

Use a customer-managed key to control the encryption at rest of the data stored in Azure API for FHIR when this is a regulatory or compliance requirement. Customer-managed keys also deliver double encryption by adding a second layer of encryption on top of the default one done with service-managed keys.

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

Azure Policy JSONHealthcareAPIs_EnableByok_Audit.json · 51 lines
{
  "properties": {
    "displayName": "Azure API for FHIR should use a customer-managed key to encrypt data at rest",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Use a customer-managed key to control the encryption at rest of the data stored in Azure API for FHIR when this is a regulatory or compliance requirement. Customer-managed keys also deliver double encryption by adding a second layer of encryption on top of the default one done with service-managed keys.",
    "metadata": {
      "version": "1.1.0",
      "category": "API for FHIR"
    },
    "version": "1.1.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "audit",
          "Audit",
          "disabled",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.HealthcareApis/services"
          },
          {
            "field": "Microsoft.HealthcareApis/services/cosmosDbConfiguration.keyVaultKeyUri",
            "exists": "false"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.1.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/051cba44-2429-45b9-9649-46cec11c7119",
  "name": "051cba44-2429-45b9-9649-46cec11c7119"
}
Bylaw051cba44-2429-45b9-9649-46cec11c7119.bylaw.ps1 · 28 lines
# Converted from HealthcareAPIs_EnableByok_Audit.json by ConvertTo-Bylaw.
Policy '051cba44-2429-45b9-9649-46cec11c7119' {

    Properties @{
        DisplayName   = 'Azure API for FHIR should use a customer-managed key to encrypt data at rest'
        Description   = 'Use a customer-managed key to control the encryption at rest of the data stored in Azure API for FHIR when this is a regulatory or compliance requirement. Customer-managed keys also deliver double encryption by adding a second layer of encryption on top of the default one done with service-managed keys.'
        Version       = '1.1.0'
        Category      = 'API for FHIR'
        PolicyVersion = '1.1.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.HealthcareApis/services' {

        Require 'cosmosDbConfiguration.keyVaultKeyUri exists' {
            Field cosmosDbConfiguration.keyVaultKeyUri | Must -Exist
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/API for FHIR/HealthcareAPIs_EnableByok_Audit.json in Azure/azure-policy, under the MIT licence.