Bylaw

Gallery › Healthcare APIs › Azure built-in policies

FHIR Service should use a customer-managed key to encrypt data at rest

Converted Policy Audit Disabled Mode Indexed Version 1.0.0

Use a customer-managed key to control the encryption at rest of the data stored in Azure Health Data Services FHIR Service 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 JSONFHIR_Service_CMK_Enabled.json · 57 lines
{
  "properties": {
    "displayName": "FHIR Service 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 Health Data Services FHIR Service 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.0.0",
      "category": "Healthcare APIs"
    },
    "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/fhirservices"
          },
          {
            "anyOf": [
              {
                "field": "Microsoft.HealthcareApis/workspaces/fhirservices/encryption.customerManagedKeyEncryption.keyEncryptionKeyUrl",
                "exists": "false"
              },
              {
                "field": "Microsoft.HealthcareApis/workspaces/fhirservices/encryption.customerManagedKeyEncryption.keyEncryptionKeyUrl",
                "equals": ""
              }
            ]
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/c42dee8c-0202-4a12-bd8e-3e171cbf64dd",
  "name": "c42dee8c-0202-4a12-bd8e-3e171cbf64dd"
}
Bylawc42dee8c-0202-4a12-bd8e-3e171cbf64dd.bylaw.ps1 · 32 lines
# Converted from FHIR_Service_CMK_Enabled.json by ConvertTo-Bylaw.
Policy 'c42dee8c-0202-4a12-bd8e-3e171cbf64dd' {

    Properties @{
        DisplayName   = 'FHIR Service 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 Health Data Services FHIR Service 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.0.0'
        Category      = 'Healthcare APIs'
        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/fhirservices' {

        Require 'encryption.customerManagedKeyEncryption.keyEncryptionKeyUrl exists' {
            Field encryption.customerManagedKeyEncryption.keyEncryptionKeyUrl | Must -Exist
        }

        Require 'encryption.customerManagedKeyEncryption.keyEncryptionKeyUrl is not' {
            Field encryption.customerManagedKeyEncryption.keyEncryptionKeyUrl | Must -Not -Be '' -IfPresent
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Healthcare APIs/FHIR_Service_CMK_Enabled.json in Azure/azure-policy, under the MIT licence.