Microsoft.CognitiveServices accounts/raiPolicies

Bicep resource definition

The accounts/raiPolicies resource type can be deployed with operations that target:

For a list of changed properties in each API version, see change log.

Usage Examples

Bicep Samples

A basic example of deploying Cognitive Services Accounts Responsible AI Policies.

param resourceName string = 'acctest0003'
param location string = 'eastus'

resource account 'Microsoft.CognitiveServices/accounts@2022-10-01' = {
  name: resourceName
  location: location
  sku: {
    name: 'S0'
  }
  kind: 'OpenAI'
  properties: {
    disableLocalAuth: false
    dynamicThrottlingEnabled: false
    publicNetworkAccess: 'Enabled'
    restrictOutboundNetworkAccess: false
  }
}

resource raiPolicy 'Microsoft.CognitiveServices/accounts/raiPolicies@2024-10-01' = {
  name: 'NoModerationPolicy'
  parent: account
  properties: {
    basePolicyName: 'Microsoft.Default'
    contentFilters: [
      {
        blocking: true
        enabled: true
        name: 'Hate'
        severityThreshold: 'High'
        source: 'Prompt'
      }
    ]
  }
}

Resource format

To create a Microsoft.CognitiveServices/accounts/raiPolicies resource, add the following Bicep to your template.

resource symbolicname 'Microsoft.CognitiveServices/accounts/raiPolicies@2026-09-15-preview' = {
  parent: resourceSymbolicName
  name: 'string'
  properties: {
    acs: {
      agent_control_specification_version: 'string'
      annotators: any(...)
      intervention_points: {
        input: {
          annotations: any(...)
          policy: {
            aacs_moderation: {
              harm_configs: [
                {
                  category: 'string'
                  harm_config_id: 'string'
                }
              ]
              subject_format: 'string'
            }
            id: 'string'
            query: 'string'
          }
          policy_target: 'string'
          policy_target_kind: 'string'
        }
        output: {
          annotations: any(...)
          policy: {
            aacs_moderation: {
              harm_configs: [
                {
                  category: 'string'
                  harm_config_id: 'string'
                }
              ]
              subject_format: 'string'
            }
            id: 'string'
            query: 'string'
          }
          policy_target: 'string'
          policy_target_kind: 'string'
        }
        post_tool_call: {
          annotations: any(...)
          policy: {
            aacs_moderation: {
              harm_configs: [
                {
                  category: 'string'
                  harm_config_id: 'string'
                }
              ]
              subject_format: 'string'
            }
            id: 'string'
            query: 'string'
          }
          policy_target: 'string'
          policy_target_kind: 'string'
          tool_name_from: 'string'
        }
        pre_tool_call: {
          annotations: any(...)
          policy: {
            aacs_moderation: {
              harm_configs: [
                {
                  category: 'string'
                  harm_config_id: 'string'
                }
              ]
              subject_format: 'string'
            }
            id: 'string'
            query: 'string'
          }
          policy_target: 'string'
          policy_target_kind: 'string'
          tool_name_from: 'string'
        }
      }
      metadata: {
        {customized property}: any(...)
      }
      policies: {
        {customized property}: {
          query: 'string'
          type: 'string'
        }
      }
      tools: {
        {customized property}: {
          clearance: 'string'
          description: 'string'
          id: 'string'
          security_labels: [
            'string'
          ]
          type: 'string'
        }
      }
    }
    acsRegos: [
      {
        regoName: 'string'
      }
    ]
    basePolicyName: 'string'
    contentFilters: [
      {
        action: 'string'
        blocking: bool
        enabled: bool
        name: 'string'
        severityThreshold: 'string'
        source: 'string'
      }
    ]
    customBlocklists: [
      {
        blocking: bool
        blocklistName: 'string'
        source: 'string'
      }
    ]
    customExternalSafetyProviders: [
      {
        blocking: bool
        externalSafetyProviderName: 'string'
        managedIdentityResourceId: 'string'
        source: 'string'
      }
    ]
    egressPolicy: {
      defaultAction: 'string'
      description: 'string'
      mode: 'string'
      rules: [
        {
          action: {
            actionType: 'string'
            headers: [
              {
                name: 'string'
                operation: 'string'
                value: 'string'
                valueRef: {
                  managedIdentityRef: {
                    format: 'string'
                    resource: 'string'
                  }
                  secretRef: {
                    format: 'string'
                    secretId: 'string'
                    secretKey: 'string'
                  }
                }
              }
            ]
            rewrite: {
              host: 'string'
              path: 'string'
              scheme: 'string'
            }
          }
          description: 'string'
          match: {
            host: 'string'
            path: 'string'
          }
          name: 'string'
          ruleType: 'string'
        }
      ]
    }
    format: 'string'
    mode: 'string'
    safetyProviders: [
      {
        blocking: bool
        safetyProviderName: 'string'
        source: 'string'
      }
    ]
  }
  tags: {
    {customized property}: 'string'
  }
}

Property Values

Microsoft.CognitiveServices/accounts/raiPolicies

Name Description Value
name The resource name string

Constraints:
Pattern = ^[a-zA-Z0-9][a-zA-Z0-9_.-]*$ (required)
parent In Bicep, you can specify the parent resource for a child resource. You only need to add this property when the child resource is declared outside of the parent resource.

For more information, see Child resource outside parent resource.
Symbolic name for resource of type: accounts
properties Properties of Cognitive Services RaiPolicy. RaiPolicyProperties
tags Resource tags Dictionary of tag names and values. See Tags in templates

CustomBlocklistConfig

Name Description Value
blocking If blocking would occur. bool
blocklistName Name of ContentFilter. string
source Content source to apply the Content Filters. 'Completion'
'PostRun'
'PostToolCall'
'PreRun'
'PreToolCall'
'Prompt'

RaiAcsHarmConfiguration

Name Description Value
category The logical harm category exposed under input.snapshot.moderation.harm. 'Hate'
'PromptInjection'
'ProtectedMaterialCode'
'ProtectedMaterialText'
'SelfHarm'
'Sexual'
'Violence' (required)
harm_config_id The Azure AI Content Safety detector configuration identifier. When supplied, it must be the
configuration supported for the selected category.
string

Constraints:
Min length = 1

RaiAcsInterventionPoint

Name Description Value
annotations Standard Agent Control Specification annotation bindings are disabled; when present, this object must be empty. any
policy The logical policy evaluated at this intervention point. RaiAcsPolicyBinding (required)
policy_target The canonical Agent Hooks snapshot path projected as the policy target. '$snap.input'
'$snap.output'
'$snap.tool_call.args'
'$snap.tool_result.value' (required)
policy_target_kind The semantic kind of the projected policy target. 'assistant_output'
'tool_args'
'tool_result'
'user_input' (required)

RaiAcsInterventionPoints

Name Description Value
input The policy evaluated for user input. RaiAcsInterventionPoint
output The policy evaluated for final output. RaiAcsInterventionPoint
post_tool_call The policy evaluated after a tool call. RaiAcsToolInterventionPoint
pre_tool_call The policy evaluated before a tool call. RaiAcsToolInterventionPoint

RaiAcsManifest

Name Description Value
agent_control_specification_version The declared Agent Control Specification manifest version. string (required)
annotators Standard Agent Control Specification annotator dispatch is disabled; when present, this object must be empty. any
intervention_points Agent Control Specification intervention-point bindings. At least one intervention point is required. RaiAcsInterventionPoints (required)
metadata Non-policy manifest metadata. RaiAcsManifestMetadata
policies Named Rego policies in this manifest. RaiAcsManifestPolicies (required)
tools Static tool catalog keyed by canonical tool name. The catalog may be omitted or empty when no
tool selector is configured. A tool selector requires a non-empty catalog, and an unknown
selected key fails closed.
RaiAcsManifestTools

RaiAcsManifestMetadata

Name Description Value

RaiAcsManifestPolicies

Name Description Value

RaiAcsManifestTools

Name Description Value

RaiAcsModerationBindingExtension

Name Description Value
harm_configs Harm signals requested for this intervention point. RaiAcsHarmConfiguration[] (required)
subject_format How the selected policy target is represented to moderation capabilities. 'canonical_json'
'text' (required)

RaiAcsPolicyBinding

Name Description Value
aacs_moderation Optional Azure AI Content Safety moderation capabilities invoked before Rego evaluation. RaiAcsModerationBindingExtension
id The logical policy identifier. string

Constraints:
Min length = 1 (required)
query An optional intervention-specific Rego query override. string

Constraints:
Min length = 1

RaiAcsRegoPolicyDefinition

Name Description Value
query The fully qualified Rego query evaluated for this policy. string

Constraints:
Min length = 1 (required)
type The policy language. This profile supports only Rego. 'rego' (required)

RaiAcsToolDefinition

Name Description Value
clearance Maximum sensitivity or host-defined clearance metadata. string

Constraints:
Min length = 1
description Human-readable policy metadata. string
id Optional host-defined tool identifier. The catalog map key, not this value, controls tool lookup. string

Constraints:
Min length = 1
security_labels Labels describing the sink or capability. string[]
type Optional host-defined tool type. string

Constraints:
Min length = 1

RaiAcsToolInterventionPoint

Name Description Value
annotations Standard Agent Control Specification annotation bindings are disabled; when present, this object must be empty. any
policy The logical policy evaluated at this intervention point. RaiAcsPolicyBinding (required)
policy_target The canonical Agent Hooks snapshot path projected as the policy target. '$snap.input'
'$snap.output'
'$snap.tool_call.args'
'$snap.tool_result.value' (required)
policy_target_kind The semantic kind of the projected policy target. 'assistant_output'
'tool_args'
'tool_result'
'user_input' (required)
tool_name_from Selects the tool catalog key from the raw Agent Hooks snapshot using an extensible snapshot path. '$.tool_call.name'
'$snap.tool_call.name'

RaiEgressHeaderTransform

Name Description Value
name The HTTP header name (e.g., "Authorization", "X-Custom-Auth"). string (required)
operation The operation to perform on this header. 'Insert'
'Remove'
'Set' (required)
value A static header value. Write-only: accepted on create/update, never returned on read.
If omitted on update, the existing value is preserved. Use this for non-sensitive values;
for credentials, use valueRef instead.
string

Constraints:
Sensitive value. Pass in as a secure parameter.
valueRef A dynamic header value resolved at request time from a secret or managed identity. RaiEgressHeaderValueRef

RaiEgressHeaderValueRef

Name Description Value
managedIdentityRef Resolve the value from a managed-identity token. RaiEgressManagedIdentityRef
secretRef Resolve the value from a stored secret. RaiEgressSecretRef

RaiEgressManagedIdentityRef

Name Description Value
format Optional format for the resolved token; "{value}" is the placeholder, e.g. "Bearer {value}". string
resource The resource/audience the token is requested for. string (required)

RaiEgressPolicyConfig

Name Description Value
defaultAction The default action when no user-defined rules match.
Deny blocks unmatched traffic; Allow permits it. Transform and Rewrite rules
are always applied to their matched traffic regardless of this setting —
defaultAction only governs traffic that does not match any rule.
If omitted on create, the server defaults to Deny (fail-closed). On subsequent
GET requests, the server always returns the effective value.
'Allow'
'Deny'
description Description of the egress policy. string
mode The enforcement mode for egress rules.
If omitted on create, the server defaults to Enforced. On subsequent GET
requests, the server always returns the effective mode.
'Audit'
'Enforced'
rules Ordered list of egress rules. First matching rule wins.
Rules are evaluated in declaration order; the first rule whose match criteria
are satisfied determines the action taken on the request.
RaiEgressRule[]

RaiEgressRewriteTarget

Name Description Value
host Target host. Original host is kept if omitted. string
path Target path (literal string). Original path (and query) is kept if omitted. string
scheme Target scheme. Original scheme is kept if omitted. 'http'
'https'

RaiEgressRule

Name Description Value
action The action to take when this rule matches, including the action type and any
type-specific configuration (headers for Transform, rewrite target for Rewrite).
RaiEgressRuleAction (required)
description Description of the rule. string
match The match criteria for this rule. RaiEgressRuleMatch
name Name of the rule. Must be unique within the policy. string (required)
ruleType The type of rule (e.g., Fqdn). Determines how match criteria are interpreted. 'Fqdn' (required)

RaiEgressRuleAction

Name Description Value
actionType The kind of action. 'Allow'
'Deny'
'Rewrite'
'Transform' (required)
headers Header transforms to apply. Required for Transform; optional for Rewrite;
not allowed for Allow or Deny.
RaiEgressHeaderTransform[]
rewrite Destination override. Required for Rewrite; not allowed otherwise. RaiEgressRewriteTarget

RaiEgressRuleMatch

Name Description Value
host Host pattern to match using DNS wildcard syntax (e.g., "*.openai.com").
A leading "*." matches any subdomain. Omit to match all hosts.
string
path Path pattern to match using URI prefix matching.
An asterisk serves as a single-segment wildcard.
For example, "/v1/*" matches "/v1/chat". Omit to match all paths.
string

RaiEgressSecretRef

Name Description Value
format Optional format for the resolved value; "{value}" is the placeholder, e.g. "Bearer {value}". string
secretId Identifier of the secret to inject. string (required)
secretKey Optional key within the secret. string

Constraints:
Sensitive value. Pass in as a secure parameter.

RaiPolicyContentFilter

Name Description Value
action The action types to apply to the content filters 'ANNOTATING'
'BLOCKING'
'HITL'
'None'
'RETRY'
blocking If blocking would occur. bool
enabled If the ContentFilter is enabled. bool
name Name of ContentFilter. string
severityThreshold Level at which content is filtered. 'High'
'Low'
'Medium'
source Content source to apply the Content Filters. 'Completion'
'PostRun'
'PostToolCall'
'PreRun'
'PreToolCall'
'Prompt'

RaiPolicyCustomExternalSafetyProviderReference

Name Description Value
blocking Whether a provider rejection blocks the request. bool
externalSafetyProviderName The registered external safety-provider name. string

Constraints:
Min length = 1 (required)
managedIdentityResourceId Optional managed identity used when invoking the external safety provider. string
source The request stage at which the provider runs. 'Completion'
'PostRun'
'PostToolCall'
'PreRun'
'PreToolCall'
'Prompt' (required)

RaiPolicyProperties

Name Description Value
acs The ACS manifest. Required by service validation when format is ACS. RaiAcsManifest
acsRegos Reusable same-account Rego resources loaded with the ACS manifest. RaiRegoReference[]
basePolicyName Name of Rai policy. string
contentFilters The list of Content Filters. RaiPolicyContentFilter[]
customBlocklists The list of custom Blocklist. CustomBlocklistConfig[]
customExternalSafetyProviders Optional external safety-provider references used by this policy. RaiPolicyCustomExternalSafetyProviderReference[]
egressPolicy Egress (outbound network) policy controlling which external endpoints sandboxed
agents can reach. Includes rules with Allow/Deny/Transform/Rewrite actions.
RaiEgressPolicyConfig
format The policy representation. Omission selects ContentFilters when creating a policy. ACS policy
creation and replacement require ACS.
'ACS'
'ContentFilters'
mode Rai policy mode. The enum value mapping is as below: Default = 0, Deferred=1, Blocking=2, Asynchronous_filter =3. Please use 'Asynchronous_filter' after 2025-06-01. It is the same as 'Deferred' in previous version. 'Asynchronous_filter'
'Blocking'
'Default'
'Deferred'
safetyProviders The list of Safety Providers. SafetyProviderConfig[]

RaiPolicyTags

Name Description Value

RaiRegoReference

Name Description Value
regoName The same-account Rego resource name. string

Constraints:
Min length = 2
Max length = 64
Pattern = ^[a-zA-Z0-9][a-zA-Z0-9_.-]{1,63}$ (required)

SafetyProviderConfig

Name Description Value
blocking If blocking would occur. bool
safetyProviderName Name of RAI Safety Provider. string
source Content source to apply the Content Filters. 'Completion'
'PostRun'
'PostToolCall'
'PreRun'
'PreToolCall'
'Prompt'

ARM template resource definition

The accounts/raiPolicies resource type can be deployed with operations that target:

Usage Examples

Resource format

To create a Microsoft.CognitiveServices/accounts/raiPolicies resource, add the following JSON to your template.

{
  "type": "Microsoft.CognitiveServices/accounts/raiPolicies",
  "apiVersion": "2026-09-15-preview",
  "name": "string",
  "properties": {
    "acs": {
      "agent_control_specification_version": "string",
      "annotators": {},
      "intervention_points": {
        "input": {
          "annotations": {},
          "policy": {
            "aacs_moderation": {
              "harm_configs": [
                {
                  "category": "string",
                  "harm_config_id": "string"
                }
              ],
              "subject_format": "string"
            },
            "id": "string",
            "query": "string"
          },
          "policy_target": "string",
          "policy_target_kind": "string"
        },
        "output": {
          "annotations": {},
          "policy": {
            "aacs_moderation": {
              "harm_configs": [
                {
                  "category": "string",
                  "harm_config_id": "string"
                }
              ],
              "subject_format": "string"
            },
            "id": "string",
            "query": "string"
          },
          "policy_target": "string",
          "policy_target_kind": "string"
        },
        "post_tool_call": {
          "annotations": {},
          "policy": {
            "aacs_moderation": {
              "harm_configs": [
                {
                  "category": "string",
                  "harm_config_id": "string"
                }
              ],
              "subject_format": "string"
            },
            "id": "string",
            "query": "string"
          },
          "policy_target": "string",
          "policy_target_kind": "string",
          "tool_name_from": "string"
        },
        "pre_tool_call": {
          "annotations": {},
          "policy": {
            "aacs_moderation": {
              "harm_configs": [
                {
                  "category": "string",
                  "harm_config_id": "string"
                }
              ],
              "subject_format": "string"
            },
            "id": "string",
            "query": "string"
          },
          "policy_target": "string",
          "policy_target_kind": "string",
          "tool_name_from": "string"
        }
      },
      "metadata": {
        "{customized property}": {}
      },
      "policies": {
        "{customized property}": {
          "query": "string",
          "type": "string"
        }
      },
      "tools": {
        "{customized property}": {
          "clearance": "string",
          "description": "string",
          "id": "string",
          "security_labels": [ "string" ],
          "type": "string"
        }
      }
    },
    "acsRegos": [
      {
        "regoName": "string"
      }
    ],
    "basePolicyName": "string",
    "contentFilters": [
      {
        "action": "string",
        "blocking": "bool",
        "enabled": "bool",
        "name": "string",
        "severityThreshold": "string",
        "source": "string"
      }
    ],
    "customBlocklists": [
      {
        "blocking": "bool",
        "blocklistName": "string",
        "source": "string"
      }
    ],
    "customExternalSafetyProviders": [
      {
        "blocking": "bool",
        "externalSafetyProviderName": "string",
        "managedIdentityResourceId": "string",
        "source": "string"
      }
    ],
    "egressPolicy": {
      "defaultAction": "string",
      "description": "string",
      "mode": "string",
      "rules": [
        {
          "action": {
            "actionType": "string",
            "headers": [
              {
                "name": "string",
                "operation": "string",
                "value": "string",
                "valueRef": {
                  "managedIdentityRef": {
                    "format": "string",
                    "resource": "string"
                  },
                  "secretRef": {
                    "format": "string",
                    "secretId": "string",
                    "secretKey": "string"
                  }
                }
              }
            ],
            "rewrite": {
              "host": "string",
              "path": "string",
              "scheme": "string"
            }
          },
          "description": "string",
          "match": {
            "host": "string",
            "path": "string"
          },
          "name": "string",
          "ruleType": "string"
        }
      ]
    },
    "format": "string",
    "mode": "string",
    "safetyProviders": [
      {
        "blocking": "bool",
        "safetyProviderName": "string",
        "source": "string"
      }
    ]
  },
  "tags": {
    "{customized property}": "string"
  }
}

Property Values

Microsoft.CognitiveServices/accounts/raiPolicies

Name Description Value
apiVersion The api version '2026-09-15-preview'
name The resource name string

Constraints:
Pattern = ^[a-zA-Z0-9][a-zA-Z0-9_.-]*$ (required)
properties Properties of Cognitive Services RaiPolicy. RaiPolicyProperties
tags Resource tags Dictionary of tag names and values. See Tags in templates
type The resource type 'Microsoft.CognitiveServices/accounts/raiPolicies'

CustomBlocklistConfig

Name Description Value
blocking If blocking would occur. bool
blocklistName Name of ContentFilter. string
source Content source to apply the Content Filters. 'Completion'
'PostRun'
'PostToolCall'
'PreRun'
'PreToolCall'
'Prompt'

RaiAcsHarmConfiguration

Name Description Value
category The logical harm category exposed under input.snapshot.moderation.harm. 'Hate'
'PromptInjection'
'ProtectedMaterialCode'
'ProtectedMaterialText'
'SelfHarm'
'Sexual'
'Violence' (required)
harm_config_id The Azure AI Content Safety detector configuration identifier. When supplied, it must be the
configuration supported for the selected category.
string

Constraints:
Min length = 1

RaiAcsInterventionPoint

Name Description Value
annotations Standard Agent Control Specification annotation bindings are disabled; when present, this object must be empty. any
policy The logical policy evaluated at this intervention point. RaiAcsPolicyBinding (required)
policy_target The canonical Agent Hooks snapshot path projected as the policy target. '$snap.input'
'$snap.output'
'$snap.tool_call.args'
'$snap.tool_result.value' (required)
policy_target_kind The semantic kind of the projected policy target. 'assistant_output'
'tool_args'
'tool_result'
'user_input' (required)

RaiAcsInterventionPoints

Name Description Value
input The policy evaluated for user input. RaiAcsInterventionPoint
output The policy evaluated for final output. RaiAcsInterventionPoint
post_tool_call The policy evaluated after a tool call. RaiAcsToolInterventionPoint
pre_tool_call The policy evaluated before a tool call. RaiAcsToolInterventionPoint

RaiAcsManifest

Name Description Value
agent_control_specification_version The declared Agent Control Specification manifest version. string (required)
annotators Standard Agent Control Specification annotator dispatch is disabled; when present, this object must be empty. any
intervention_points Agent Control Specification intervention-point bindings. At least one intervention point is required. RaiAcsInterventionPoints (required)
metadata Non-policy manifest metadata. RaiAcsManifestMetadata
policies Named Rego policies in this manifest. RaiAcsManifestPolicies (required)
tools Static tool catalog keyed by canonical tool name. The catalog may be omitted or empty when no
tool selector is configured. A tool selector requires a non-empty catalog, and an unknown
selected key fails closed.
RaiAcsManifestTools

RaiAcsManifestMetadata

Name Description Value

RaiAcsManifestPolicies

Name Description Value

RaiAcsManifestTools

Name Description Value

RaiAcsModerationBindingExtension

Name Description Value
harm_configs Harm signals requested for this intervention point. RaiAcsHarmConfiguration[] (required)
subject_format How the selected policy target is represented to moderation capabilities. 'canonical_json'
'text' (required)

RaiAcsPolicyBinding

Name Description Value
aacs_moderation Optional Azure AI Content Safety moderation capabilities invoked before Rego evaluation. RaiAcsModerationBindingExtension
id The logical policy identifier. string

Constraints:
Min length = 1 (required)
query An optional intervention-specific Rego query override. string

Constraints:
Min length = 1

RaiAcsRegoPolicyDefinition

Name Description Value
query The fully qualified Rego query evaluated for this policy. string

Constraints:
Min length = 1 (required)
type The policy language. This profile supports only Rego. 'rego' (required)

RaiAcsToolDefinition

Name Description Value
clearance Maximum sensitivity or host-defined clearance metadata. string

Constraints:
Min length = 1
description Human-readable policy metadata. string
id Optional host-defined tool identifier. The catalog map key, not this value, controls tool lookup. string

Constraints:
Min length = 1
security_labels Labels describing the sink or capability. string[]
type Optional host-defined tool type. string

Constraints:
Min length = 1

RaiAcsToolInterventionPoint

Name Description Value
annotations Standard Agent Control Specification annotation bindings are disabled; when present, this object must be empty. any
policy The logical policy evaluated at this intervention point. RaiAcsPolicyBinding (required)
policy_target The canonical Agent Hooks snapshot path projected as the policy target. '$snap.input'
'$snap.output'
'$snap.tool_call.args'
'$snap.tool_result.value' (required)
policy_target_kind The semantic kind of the projected policy target. 'assistant_output'
'tool_args'
'tool_result'
'user_input' (required)
tool_name_from Selects the tool catalog key from the raw Agent Hooks snapshot using an extensible snapshot path. '$.tool_call.name'
'$snap.tool_call.name'

RaiEgressHeaderTransform

Name Description Value
name The HTTP header name (e.g., "Authorization", "X-Custom-Auth"). string (required)
operation The operation to perform on this header. 'Insert'
'Remove'
'Set' (required)
value A static header value. Write-only: accepted on create/update, never returned on read.
If omitted on update, the existing value is preserved. Use this for non-sensitive values;
for credentials, use valueRef instead.
string

Constraints:
Sensitive value. Pass in as a secure parameter.
valueRef A dynamic header value resolved at request time from a secret or managed identity. RaiEgressHeaderValueRef

RaiEgressHeaderValueRef

Name Description Value
managedIdentityRef Resolve the value from a managed-identity token. RaiEgressManagedIdentityRef
secretRef Resolve the value from a stored secret. RaiEgressSecretRef

RaiEgressManagedIdentityRef

Name Description Value
format Optional format for the resolved token; "{value}" is the placeholder, e.g. "Bearer {value}". string
resource The resource/audience the token is requested for. string (required)

RaiEgressPolicyConfig

Name Description Value
defaultAction The default action when no user-defined rules match.
Deny blocks unmatched traffic; Allow permits it. Transform and Rewrite rules
are always applied to their matched traffic regardless of this setting —
defaultAction only governs traffic that does not match any rule.
If omitted on create, the server defaults to Deny (fail-closed). On subsequent
GET requests, the server always returns the effective value.
'Allow'
'Deny'
description Description of the egress policy. string
mode The enforcement mode for egress rules.
If omitted on create, the server defaults to Enforced. On subsequent GET
requests, the server always returns the effective mode.
'Audit'
'Enforced'
rules Ordered list of egress rules. First matching rule wins.
Rules are evaluated in declaration order; the first rule whose match criteria
are satisfied determines the action taken on the request.
RaiEgressRule[]

RaiEgressRewriteTarget

Name Description Value
host Target host. Original host is kept if omitted. string
path Target path (literal string). Original path (and query) is kept if omitted. string
scheme Target scheme. Original scheme is kept if omitted. 'http'
'https'

RaiEgressRule

Name Description Value
action The action to take when this rule matches, including the action type and any
type-specific configuration (headers for Transform, rewrite target for Rewrite).
RaiEgressRuleAction (required)
description Description of the rule. string
match The match criteria for this rule. RaiEgressRuleMatch
name Name of the rule. Must be unique within the policy. string (required)
ruleType The type of rule (e.g., Fqdn). Determines how match criteria are interpreted. 'Fqdn' (required)

RaiEgressRuleAction

Name Description Value
actionType The kind of action. 'Allow'
'Deny'
'Rewrite'
'Transform' (required)
headers Header transforms to apply. Required for Transform; optional for Rewrite;
not allowed for Allow or Deny.
RaiEgressHeaderTransform[]
rewrite Destination override. Required for Rewrite; not allowed otherwise. RaiEgressRewriteTarget

RaiEgressRuleMatch

Name Description Value
host Host pattern to match using DNS wildcard syntax (e.g., "*.openai.com").
A leading "*." matches any subdomain. Omit to match all hosts.
string
path Path pattern to match using URI prefix matching.
An asterisk serves as a single-segment wildcard.
For example, "/v1/*" matches "/v1/chat". Omit to match all paths.
string

RaiEgressSecretRef

Name Description Value
format Optional format for the resolved value; "{value}" is the placeholder, e.g. "Bearer {value}". string
secretId Identifier of the secret to inject. string (required)
secretKey Optional key within the secret. string

Constraints:
Sensitive value. Pass in as a secure parameter.

RaiPolicyContentFilter

Name Description Value
action The action types to apply to the content filters 'ANNOTATING'
'BLOCKING'
'HITL'
'None'
'RETRY'
blocking If blocking would occur. bool
enabled If the ContentFilter is enabled. bool
name Name of ContentFilter. string
severityThreshold Level at which content is filtered. 'High'
'Low'
'Medium'
source Content source to apply the Content Filters. 'Completion'
'PostRun'
'PostToolCall'
'PreRun'
'PreToolCall'
'Prompt'

RaiPolicyCustomExternalSafetyProviderReference

Name Description Value
blocking Whether a provider rejection blocks the request. bool
externalSafetyProviderName The registered external safety-provider name. string

Constraints:
Min length = 1 (required)
managedIdentityResourceId Optional managed identity used when invoking the external safety provider. string
source The request stage at which the provider runs. 'Completion'
'PostRun'
'PostToolCall'
'PreRun'
'PreToolCall'
'Prompt' (required)

RaiPolicyProperties

Name Description Value
acs The ACS manifest. Required by service validation when format is ACS. RaiAcsManifest
acsRegos Reusable same-account Rego resources loaded with the ACS manifest. RaiRegoReference[]
basePolicyName Name of Rai policy. string
contentFilters The list of Content Filters. RaiPolicyContentFilter[]
customBlocklists The list of custom Blocklist. CustomBlocklistConfig[]
customExternalSafetyProviders Optional external safety-provider references used by this policy. RaiPolicyCustomExternalSafetyProviderReference[]
egressPolicy Egress (outbound network) policy controlling which external endpoints sandboxed
agents can reach. Includes rules with Allow/Deny/Transform/Rewrite actions.
RaiEgressPolicyConfig
format The policy representation. Omission selects ContentFilters when creating a policy. ACS policy
creation and replacement require ACS.
'ACS'
'ContentFilters'
mode Rai policy mode. The enum value mapping is as below: Default = 0, Deferred=1, Blocking=2, Asynchronous_filter =3. Please use 'Asynchronous_filter' after 2025-06-01. It is the same as 'Deferred' in previous version. 'Asynchronous_filter'
'Blocking'
'Default'
'Deferred'
safetyProviders The list of Safety Providers. SafetyProviderConfig[]

RaiPolicyTags

Name Description Value

RaiRegoReference

Name Description Value
regoName The same-account Rego resource name. string

Constraints:
Min length = 2
Max length = 64
Pattern = ^[a-zA-Z0-9][a-zA-Z0-9_.-]{1,63}$ (required)

SafetyProviderConfig

Name Description Value
blocking If blocking would occur. bool
safetyProviderName Name of RAI Safety Provider. string
source Content source to apply the Content Filters. 'Completion'
'PostRun'
'PostToolCall'
'PreRun'
'PreToolCall'
'Prompt'

Terraform (AzAPI provider) resource definition

The accounts/raiPolicies resource type can be deployed with operations that target:

  • Resource groups For a list of changed properties in each API version, see change log.

Usage Examples

Terraform Samples

A basic example of deploying Cognitive Services Accounts Responsible AI Policies.

terraform {
  required_providers {
    azapi = {
      source = "Azure/azapi"
    }
  }
}

provider "azapi" {
  skip_provider_registration = false
}

variable "resource_name" {
  type    = string
  default = "acctest0003"
}

variable "location" {
  type    = string
  default = "eastus"
}

resource "azapi_resource" "resourceGroup" {
  type     = "Microsoft.Resources/resourceGroups@2020-06-01"
  name     = var.resource_name
  location = var.location
}

resource "azapi_resource" "account" {
  type      = "Microsoft.CognitiveServices/accounts@2022-10-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location

  body = {
    kind = "OpenAI"
    properties = {
      disableLocalAuth              = false
      dynamicThrottlingEnabled      = false
      publicNetworkAccess           = "Enabled"
      restrictOutboundNetworkAccess = false
    }
    sku = {
      name = "S0"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "raiPolicy" {
  type      = "Microsoft.CognitiveServices/accounts/raiPolicies@2024-10-01"
  name      = "NoModerationPolicy"
  parent_id = azapi_resource.account.id

  body = {
    properties = {
      basePolicyName = "Microsoft.Default"
      contentFilters = [
        {
          blocking          = true
          enabled           = true
          name              = "Hate"
          severityThreshold = "High"
          source            = "Prompt"
        }
      ]
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

Resource format

To create a Microsoft.CognitiveServices/accounts/raiPolicies resource, add the following Terraform to your template.

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.CognitiveServices/accounts/raiPolicies@2026-09-15-preview"
  name = "string"
  parent_id = "string"
  tags = {
    {customized property} = "string"
  }
  body = {
    properties = {
      acs = {
        agent_control_specification_version = "string"
        annotators = ?
        intervention_points = {
          input = {
            annotations = ?
            policy = {
              aacs_moderation = {
                harm_configs = [
                  {
                    category = "string"
                    harm_config_id = "string"
                  }
                ]
                subject_format = "string"
              }
              id = "string"
              query = "string"
            }
            policy_target = "string"
            policy_target_kind = "string"
          }
          output = {
            annotations = ?
            policy = {
              aacs_moderation = {
                harm_configs = [
                  {
                    category = "string"
                    harm_config_id = "string"
                  }
                ]
                subject_format = "string"
              }
              id = "string"
              query = "string"
            }
            policy_target = "string"
            policy_target_kind = "string"
          }
          post_tool_call = {
            annotations = ?
            policy = {
              aacs_moderation = {
                harm_configs = [
                  {
                    category = "string"
                    harm_config_id = "string"
                  }
                ]
                subject_format = "string"
              }
              id = "string"
              query = "string"
            }
            policy_target = "string"
            policy_target_kind = "string"
            tool_name_from = "string"
          }
          pre_tool_call = {
            annotations = ?
            policy = {
              aacs_moderation = {
                harm_configs = [
                  {
                    category = "string"
                    harm_config_id = "string"
                  }
                ]
                subject_format = "string"
              }
              id = "string"
              query = "string"
            }
            policy_target = "string"
            policy_target_kind = "string"
            tool_name_from = "string"
          }
        }
        metadata = {
          {customized property} = ?
        }
        policies = {
          {customized property} = {
            query = "string"
            type = "string"
          }
        }
        tools = {
          {customized property} = {
            clearance = "string"
            description = "string"
            id = "string"
            security_labels = [
              "string"
            ]
            type = "string"
          }
        }
      }
      acsRegos = [
        {
          regoName = "string"
        }
      ]
      basePolicyName = "string"
      contentFilters = [
        {
          action = "string"
          blocking = bool
          enabled = bool
          name = "string"
          severityThreshold = "string"
          source = "string"
        }
      ]
      customBlocklists = [
        {
          blocking = bool
          blocklistName = "string"
          source = "string"
        }
      ]
      customExternalSafetyProviders = [
        {
          blocking = bool
          externalSafetyProviderName = "string"
          managedIdentityResourceId = "string"
          source = "string"
        }
      ]
      egressPolicy = {
        defaultAction = "string"
        description = "string"
        mode = "string"
        rules = [
          {
            action = {
              actionType = "string"
              headers = [
                {
                  name = "string"
                  operation = "string"
                  value = "string"
                  valueRef = {
                    managedIdentityRef = {
                      format = "string"
                      resource = "string"
                    }
                    secretRef = {
                      format = "string"
                      secretId = "string"
                      secretKey = "string"
                    }
                  }
                }
              ]
              rewrite = {
                host = "string"
                path = "string"
                scheme = "string"
              }
            }
            description = "string"
            match = {
              host = "string"
              path = "string"
            }
            name = "string"
            ruleType = "string"
          }
        ]
      }
      format = "string"
      mode = "string"
      safetyProviders = [
        {
          blocking = bool
          safetyProviderName = "string"
          source = "string"
        }
      ]
    }
  }
}

Property Values

Microsoft.CognitiveServices/accounts/raiPolicies

Name Description Value
name The resource name string

Constraints:
Pattern = ^[a-zA-Z0-9][a-zA-Z0-9_.-]*$ (required)
parent_id The ID of the resource that is the parent for this resource. ID for resource of type: accounts
properties Properties of Cognitive Services RaiPolicy. RaiPolicyProperties
tags Resource tags Dictionary of tag names and values.
type The resource type "Microsoft.CognitiveServices/accounts/raiPolicies@2026-09-15-preview"

CustomBlocklistConfig

Name Description Value
blocking If blocking would occur. bool
blocklistName Name of ContentFilter. string
source Content source to apply the Content Filters. 'Completion'
'PostRun'
'PostToolCall'
'PreRun'
'PreToolCall'
'Prompt'

RaiAcsHarmConfiguration

Name Description Value
category The logical harm category exposed under input.snapshot.moderation.harm. 'Hate'
'PromptInjection'
'ProtectedMaterialCode'
'ProtectedMaterialText'
'SelfHarm'
'Sexual'
'Violence' (required)
harm_config_id The Azure AI Content Safety detector configuration identifier. When supplied, it must be the
configuration supported for the selected category.
string

Constraints:
Min length = 1

RaiAcsInterventionPoint

Name Description Value
annotations Standard Agent Control Specification annotation bindings are disabled; when present, this object must be empty. any
policy The logical policy evaluated at this intervention point. RaiAcsPolicyBinding (required)
policy_target The canonical Agent Hooks snapshot path projected as the policy target. '$snap.input'
'$snap.output'
'$snap.tool_call.args'
'$snap.tool_result.value' (required)
policy_target_kind The semantic kind of the projected policy target. 'assistant_output'
'tool_args'
'tool_result'
'user_input' (required)

RaiAcsInterventionPoints

Name Description Value
input The policy evaluated for user input. RaiAcsInterventionPoint
output The policy evaluated for final output. RaiAcsInterventionPoint
post_tool_call The policy evaluated after a tool call. RaiAcsToolInterventionPoint
pre_tool_call The policy evaluated before a tool call. RaiAcsToolInterventionPoint

RaiAcsManifest

Name Description Value
agent_control_specification_version The declared Agent Control Specification manifest version. string (required)
annotators Standard Agent Control Specification annotator dispatch is disabled; when present, this object must be empty. any
intervention_points Agent Control Specification intervention-point bindings. At least one intervention point is required. RaiAcsInterventionPoints (required)
metadata Non-policy manifest metadata. RaiAcsManifestMetadata
policies Named Rego policies in this manifest. RaiAcsManifestPolicies (required)
tools Static tool catalog keyed by canonical tool name. The catalog may be omitted or empty when no
tool selector is configured. A tool selector requires a non-empty catalog, and an unknown
selected key fails closed.
RaiAcsManifestTools

RaiAcsManifestMetadata

Name Description Value

RaiAcsManifestPolicies

Name Description Value

RaiAcsManifestTools

Name Description Value

RaiAcsModerationBindingExtension

Name Description Value
harm_configs Harm signals requested for this intervention point. RaiAcsHarmConfiguration[] (required)
subject_format How the selected policy target is represented to moderation capabilities. 'canonical_json'
'text' (required)

RaiAcsPolicyBinding

Name Description Value
aacs_moderation Optional Azure AI Content Safety moderation capabilities invoked before Rego evaluation. RaiAcsModerationBindingExtension
id The logical policy identifier. string

Constraints:
Min length = 1 (required)
query An optional intervention-specific Rego query override. string

Constraints:
Min length = 1

RaiAcsRegoPolicyDefinition

Name Description Value
query The fully qualified Rego query evaluated for this policy. string

Constraints:
Min length = 1 (required)
type The policy language. This profile supports only Rego. 'rego' (required)

RaiAcsToolDefinition

Name Description Value
clearance Maximum sensitivity or host-defined clearance metadata. string

Constraints:
Min length = 1
description Human-readable policy metadata. string
id Optional host-defined tool identifier. The catalog map key, not this value, controls tool lookup. string

Constraints:
Min length = 1
security_labels Labels describing the sink or capability. string[]
type Optional host-defined tool type. string

Constraints:
Min length = 1

RaiAcsToolInterventionPoint

Name Description Value
annotations Standard Agent Control Specification annotation bindings are disabled; when present, this object must be empty. any
policy The logical policy evaluated at this intervention point. RaiAcsPolicyBinding (required)
policy_target The canonical Agent Hooks snapshot path projected as the policy target. '$snap.input'
'$snap.output'
'$snap.tool_call.args'
'$snap.tool_result.value' (required)
policy_target_kind The semantic kind of the projected policy target. 'assistant_output'
'tool_args'
'tool_result'
'user_input' (required)
tool_name_from Selects the tool catalog key from the raw Agent Hooks snapshot using an extensible snapshot path. '$.tool_call.name'
'$snap.tool_call.name'

RaiEgressHeaderTransform

Name Description Value
name The HTTP header name (e.g., "Authorization", "X-Custom-Auth"). string (required)
operation The operation to perform on this header. 'Insert'
'Remove'
'Set' (required)
value A static header value. Write-only: accepted on create/update, never returned on read.
If omitted on update, the existing value is preserved. Use this for non-sensitive values;
for credentials, use valueRef instead.
string

Constraints:
Sensitive value. Pass in as a secure parameter.
valueRef A dynamic header value resolved at request time from a secret or managed identity. RaiEgressHeaderValueRef

RaiEgressHeaderValueRef

Name Description Value
managedIdentityRef Resolve the value from a managed-identity token. RaiEgressManagedIdentityRef
secretRef Resolve the value from a stored secret. RaiEgressSecretRef

RaiEgressManagedIdentityRef

Name Description Value
format Optional format for the resolved token; "{value}" is the placeholder, e.g. "Bearer {value}". string
resource The resource/audience the token is requested for. string (required)

RaiEgressPolicyConfig

Name Description Value
defaultAction The default action when no user-defined rules match.
Deny blocks unmatched traffic; Allow permits it. Transform and Rewrite rules
are always applied to their matched traffic regardless of this setting —
defaultAction only governs traffic that does not match any rule.
If omitted on create, the server defaults to Deny (fail-closed). On subsequent
GET requests, the server always returns the effective value.
'Allow'
'Deny'
description Description of the egress policy. string
mode The enforcement mode for egress rules.
If omitted on create, the server defaults to Enforced. On subsequent GET
requests, the server always returns the effective mode.
'Audit'
'Enforced'
rules Ordered list of egress rules. First matching rule wins.
Rules are evaluated in declaration order; the first rule whose match criteria
are satisfied determines the action taken on the request.
RaiEgressRule[]

RaiEgressRewriteTarget

Name Description Value
host Target host. Original host is kept if omitted. string
path Target path (literal string). Original path (and query) is kept if omitted. string
scheme Target scheme. Original scheme is kept if omitted. 'http'
'https'

RaiEgressRule

Name Description Value
action The action to take when this rule matches, including the action type and any
type-specific configuration (headers for Transform, rewrite target for Rewrite).
RaiEgressRuleAction (required)
description Description of the rule. string
match The match criteria for this rule. RaiEgressRuleMatch
name Name of the rule. Must be unique within the policy. string (required)
ruleType The type of rule (e.g., Fqdn). Determines how match criteria are interpreted. 'Fqdn' (required)

RaiEgressRuleAction

Name Description Value
actionType The kind of action. 'Allow'
'Deny'
'Rewrite'
'Transform' (required)
headers Header transforms to apply. Required for Transform; optional for Rewrite;
not allowed for Allow or Deny.
RaiEgressHeaderTransform[]
rewrite Destination override. Required for Rewrite; not allowed otherwise. RaiEgressRewriteTarget

RaiEgressRuleMatch

Name Description Value
host Host pattern to match using DNS wildcard syntax (e.g., "*.openai.com").
A leading "*." matches any subdomain. Omit to match all hosts.
string
path Path pattern to match using URI prefix matching.
An asterisk serves as a single-segment wildcard.
For example, "/v1/*" matches "/v1/chat". Omit to match all paths.
string

RaiEgressSecretRef

Name Description Value
format Optional format for the resolved value; "{value}" is the placeholder, e.g. "Bearer {value}". string
secretId Identifier of the secret to inject. string (required)
secretKey Optional key within the secret. string

Constraints:
Sensitive value. Pass in as a secure parameter.

RaiPolicyContentFilter

Name Description Value
action The action types to apply to the content filters 'ANNOTATING'
'BLOCKING'
'HITL'
'None'
'RETRY'
blocking If blocking would occur. bool
enabled If the ContentFilter is enabled. bool
name Name of ContentFilter. string
severityThreshold Level at which content is filtered. 'High'
'Low'
'Medium'
source Content source to apply the Content Filters. 'Completion'
'PostRun'
'PostToolCall'
'PreRun'
'PreToolCall'
'Prompt'

RaiPolicyCustomExternalSafetyProviderReference

Name Description Value
blocking Whether a provider rejection blocks the request. bool
externalSafetyProviderName The registered external safety-provider name. string

Constraints:
Min length = 1 (required)
managedIdentityResourceId Optional managed identity used when invoking the external safety provider. string
source The request stage at which the provider runs. 'Completion'
'PostRun'
'PostToolCall'
'PreRun'
'PreToolCall'
'Prompt' (required)

RaiPolicyProperties

Name Description Value
acs The ACS manifest. Required by service validation when format is ACS. RaiAcsManifest
acsRegos Reusable same-account Rego resources loaded with the ACS manifest. RaiRegoReference[]
basePolicyName Name of Rai policy. string
contentFilters The list of Content Filters. RaiPolicyContentFilter[]
customBlocklists The list of custom Blocklist. CustomBlocklistConfig[]
customExternalSafetyProviders Optional external safety-provider references used by this policy. RaiPolicyCustomExternalSafetyProviderReference[]
egressPolicy Egress (outbound network) policy controlling which external endpoints sandboxed
agents can reach. Includes rules with Allow/Deny/Transform/Rewrite actions.
RaiEgressPolicyConfig
format The policy representation. Omission selects ContentFilters when creating a policy. ACS policy
creation and replacement require ACS.
'ACS'
'ContentFilters'
mode Rai policy mode. The enum value mapping is as below: Default = 0, Deferred=1, Blocking=2, Asynchronous_filter =3. Please use 'Asynchronous_filter' after 2025-06-01. It is the same as 'Deferred' in previous version. 'Asynchronous_filter'
'Blocking'
'Default'
'Deferred'
safetyProviders The list of Safety Providers. SafetyProviderConfig[]

RaiPolicyTags

Name Description Value

RaiRegoReference

Name Description Value
regoName The same-account Rego resource name. string

Constraints:
Min length = 2
Max length = 64
Pattern = ^[a-zA-Z0-9][a-zA-Z0-9_.-]{1,63}$ (required)

SafetyProviderConfig

Name Description Value
blocking If blocking would occur. bool
safetyProviderName Name of RAI Safety Provider. string
source Content source to apply the Content Filters. 'Completion'
'PostRun'
'PostToolCall'
'PreRun'
'PreToolCall'
'Prompt'