Bylaw

Gallery › Cognitive Services › Azure built-in policies

[Preview]: Cognitive Services Deployments should only use allowed prompt content filtering

Doesn't convert yet Policy Audit Disabled Mode Microsoft.CognitiveServices.Data Version 1.0.0-preview Preview

Mandate minimum levels of content filtering for prompt content for model deployments within your organization.

ConvertTo-Bylaw can't convert this policy yet:

Azure Policy JSONAllowDeploymentPromptControl_Audit.json · 113 lines
{
  "properties": {
    "displayName": "[Preview]: Cognitive Services Deployments should only use allowed prompt content filtering",
    "policyType": "BuiltIn",
    "mode": "Microsoft.CognitiveServices.Data",
    "description": "Mandate minimum levels of content filtering for prompt content for model deployments within your organization.",
    "metadata": {
      "version": "1.0.0-preview",
      "category": "Cognitive Services",
      "preview": true
    },
    "version": "1.0.0-preview",
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "Audit",
        "allowedValues": [
          "Audit",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy."
        }
      },
      "filterName": {
        "type": "string",
        "allowedValues": [
          "Profanity",
          "Jailbreak",
          "Indirect Attack",
          "Indirect Attack Spotlighting"
        ],
        "metadata": {
          "displayName": "Content Filter",
          "description": "Content filter name."
        }
      },
      "allowedEnabledForPrompt": {
        "type": "Array",
        "defaultValue": [
          "true"
        ],
        "allowedValues": [
          "true",
          "false"
        ],
        "metadata": {
          "displayName": "Allowed Enabled Configuration for Prompt",
          "description": "List of acceptable Enabled values for Prompt. Can be set to true, false, or both. True implies that content filtering must be Enabled, False implies that content filtering must be disabled, and setting both true and false implies that either setting is okay."
        }
      },
      "allowedBlockingForPrompt": {
        "type": "Array",
        "defaultValue": [
          "true"
        ],
        "allowedValues": [
          "true",
          "false"
        ],
        "metadata": {
          "displayName": "Allowed Blocking Configuration for Prompt",
          "description": "List of acceptable Blocking values for Prompt. Can be set to true, false, or both. True implies that content filtering must be blocking, False implies that content filtering must not be blocking, and setting both true and false implies that either setting is okay."
        }
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.CognitiveServices.Data/accounts/deployments"
          },
          {
            "count": {
              "field": "Microsoft.CognitiveServices.Data/accounts/deployments/raiPolicy.contentFilters[*]",
              "where": {
                "allOf": [
                  {
                    "field": "Microsoft.CognitiveServices.Data/accounts/deployments/raiPolicy.contentFilters[*].name",
                    "equals": "[parameters('filterName')]"
                  },
                  {
                    "field": "Microsoft.CognitiveServices.Data/accounts/deployments/raiPolicy.contentFilters[*].source",
                    "equals": "Prompt"
                  },
                  {
                    "field": "Microsoft.CognitiveServices.Data/accounts/deployments/raiPolicy.contentFilters[*].enabled",
                    "in": "[parameters('allowedEnabledForPrompt')]"
                  },
                  {
                    "field": "Microsoft.CognitiveServices.Data/accounts/deployments/raiPolicy.contentFilters[*].blocking",
                    "in": "[parameters('allowedBlockingForPrompt')]"
                  }
                ]
              }
            },
            "equals": 0
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0-PREVIEW"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/f3a9c2e0-7b4d-4d8f-9c3a-2e1f6b9a8d4e",
  "name": "f3a9c2e0-7b4d-4d8f-9c3a-2e1f6b9a8d4e"
}

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