Bylaw

Gallery › Cognitive Services › Azure built-in policies

[Deprecated]: Cognitive Services accounts should enable data encryption

Converted Policy Audit Deny Disabled Mode Indexed Version 2.0.0-deprecated Deprecated

This policy is deprecated. Cognitive Services have data encryption enforced.

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

Azure Policy JSONEncryption_Audit.json · 55 lines
{
  "properties": {
    "displayName": "[Deprecated]: Cognitive Services accounts should enable data encryption",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "This policy is deprecated. Cognitive Services have data encryption enforced.",
    "metadata": {
      "version": "2.0.0-deprecated",
      "category": "Cognitive Services",
      "deprecated": true
    },
    "version": "2.0.0",
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "Disabled",
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "The effect determines what happens when the policy rule is evaluated to match"
        }
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.CognitiveServices/accounts"
          },
          {
            "field": "Microsoft.CognitiveServices/accounts/encryption.keySource",
            "exists": "false"
          },
          {
            "field": "Microsoft.CognitiveServices/accounts/encryption",
            "exists": "true"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "2.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/2bdd0062-9d75-436e-89df-487dd8e4b3c7",
  "name": "2bdd0062-9d75-436e-89df-487dd8e4b3c7"
}
Bylaw2bdd0062-9d75-436e-89df-487dd8e4b3c7.bylaw.ps1 · 34 lines
# Converted from Encryption_Audit.json by ConvertTo-Bylaw.
Policy '2bdd0062-9d75-436e-89df-487dd8e4b3c7' {

    Properties @{
        DisplayName   = '[Deprecated]: Cognitive Services accounts should enable data encryption'
        Description   = 'This policy is deprecated. Cognitive Services have data encryption enforced.'
        Version       = '2.0.0-deprecated'
        Category      = 'Cognitive Services'
        Deprecated    = $true
        PolicyVersion = '2.0.0'
        Mode          = 'Indexed'
    }

    Parameter Effect @{
        Type          = 'string'
        AllowedValues = @('Audit', 'Deny', 'Disabled')
        Default       = 'Disabled'
        DisplayName   = 'Effect'
        Description   = 'The effect determines what happens when the policy rule is evaluated to match'
    }

    Resource 'Microsoft.CognitiveServices/accounts' {

        When {
            Field encryption.keySource | Must -Not -Exist
        }

        Require 'encryption does not exist' {
            Field encryption | Must -Not -Exist
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Cognitive Services/Encryption_Audit.json in Azure/azure-policy, under the MIT licence.