Azure OpenAI models come with a content filter that blocks harmful prompts and responses. It is on by default, so most teams never look at it. Then a real customer question gets blocked, someone changes a setting by hand in the portal, and nobody can say what the app filters any more.
That's why you should choose the filter settings for your app on purpose, and keep them in the repo.
Note: The new Microsoft Foundry portal calls content filters "guardrails".
| What it checks | Where | Default |
|---|---|---|
| Hate, sexual, violence and self-harm content | Prompts and responses | Blocks medium and high severity |
| Jailbreak attempts | Prompts | On |
| Protected text and code | Responses | On |
| Attacks hidden in documents | Prompts | Off |
Figure: The default filter for text models
finish_reason set to content_filter. Show the user a clear message for bothDefine the filter in Bicep and name it on the model deployment. A change to what the app blocks then goes through a pull request, like any other Azure resource.
resource chat 'Microsoft.CognitiveServices/accounts/deployments@2024-10-01' = {parent: accountname: 'support-chat'properties: {model: chatModel// no filter named here}}
❌ Figure: Bad example - The deployment names no filter. The settings live only in the portal, so nobody can review a change
resource filter 'Microsoft.CognitiveServices/accounts/raiPolicies@2024-10-01' = {parent: accountname: 'northwind-support-chat'properties: {basePolicyName: 'Microsoft.Default'contentFilters: [// Stricter than the default (Medium): the chat is open to the public{ name: 'Hate', source: 'Prompt', severityThreshold: 'Low', blocking: true, enabled: true }{ name: 'Hate', source: 'Completion', severityThreshold: 'Low', blocking: true, enabled: true }// The same two lines for Sexual, Violence and Selfharm]}}resource chat 'Microsoft.CognitiveServices/accounts/deployments@2024-10-01' = {parent: accountname: 'support-chat'properties: {model: chatModelraiPolicyName: filter.name}}
✅ Figure: Good example - The filter is in Bicep with the reason beside it, and the deployment names it