Bylaw

Gallery › Cognitive Services › Azure Community Policy

Audit OpenAI instances with content filtering enabled

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0

Azure OpenAI Service includes a content management system that filters content. If you are working with sensitive data, content filtering should be disabled so that Microsoft is not processing your data.

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

Azure Policy JSONazurepolicy.json · 53 lines
{
  "name": "5e68f029-0f81-4ee3-b578-705b0fdb237d",
  "type": "Microsoft.Authorization/policyDefinitions",
  "properties": {
    "displayName": "Audit OpenAI instances with content filtering enabled",
    "description": "Azure OpenAI Service includes a content management system that filters content. If you are working with sensitive data, content filtering should be disabled so that Microsoft is not processing your data.",
    "metadata": {
      "category": "Cognitive Services",
      "version": "1.0.0"
    },
    "mode": "Indexed",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.CognitiveServices/accounts"
          },
          {
            "field": "kind",
            "equals": "OpenAI"
          },
          {
            "anyOf": [
              {
                "field": "Microsoft.CognitiveServices/accounts/capabilities[*].name",
                "notEquals": "ContentLogging"
              }
            ]
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    }
  }
}
Bylaw5e68f029-0f81-4ee3-b578-705b0fdb237d.bylaw.ps1 · 33 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '5e68f029-0f81-4ee3-b578-705b0fdb237d' {

    Properties @{
        DisplayName = 'Audit OpenAI instances with content filtering enabled'
        Description = 'Azure OpenAI Service includes a content management system that filters content. If you are working with sensitive data, content filtering should be disabled so that Microsoft is not processing your data.'
        Category    = 'Cognitive Services'
        Version     = '1.0.0'
        Mode        = 'Indexed'
    }

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

    Resource 'Microsoft.CognitiveServices/accounts' {

        When {
            Field kind | Must -Be 'OpenAI'
        }

        Require 'capabilities and name are as required' {
            Count 'capabilities[*]' -Where {
                Field name | Must -Be 'ContentLogging'
            } | Must -Not -Be 0
        }
    }

    Effect (Param Effect)
}

Source: policyDefinitions/Cognitive Services/audit-content-logging/azurepolicy.json in Azure/Community-Policy, under the MIT licence.