Home › Studies › SC-500 › Secure Compute › AI Workload Security

AI Workload Security

AI Gateway in API Management for Foundry · Defender for AI Services · Foundry guardrails · Data and AI security dashboard

By the tools4free.dev team · Last reviewed November 13, 2026

Practice questions for this topic →

AI Gateway in Azure API Management for Foundry

The AI gateway in Azure API Management is a set of capabilities for managing AI backends: securing, scaling, monitoring and governing AI models, agents and tools. It extends API Management's existing API gateway and is not a separate offering. In Microsoft Foundry, AI Gateway uses API Management behind the scenes to provide token limits, quotas and governance for model deployments.

AreaCapability
Security and safetyManaged identities to authenticate to AI services (no API keys); OAuth authorization for apps and agents through the credential manager; prompt moderation with Azure AI Content Safety
Scalability and performanceToken limit policy (llm-token-limit) with a tokens-per-minute limit or a quota; semantic caching with Azure Managed Redis or another RediSearch-compatible external cache; scale units and regional gateways
ResiliencyBackends with load balancing and circuit breaker rules that stop forwarding to unresponsive AI backends
Traffic mediationImport OpenAI-compatible or passthrough LLM endpoints and models in Foundry or other providers; expose REST APIs as MCP servers; manage A2A agent APIs

Content safety policy prerequisites

Enable AI Gateway for a Foundry resource

  1. Sign in to Microsoft Foundry with the New Foundry toggle on and select Manage > AI Gateway > Add AI Gateway.
  2. Select the Foundry resource and choose Create new or Use existing API Management.
  3. Name the gateway and select Add. Wait until the status shows Enabled (provisioning of a Basic v2 instance typically takes 5-10 minutes).
  4. Add existing projects with Add project to gateway. New projects created in the Foundry resource have AI Gateway enabled by default.
RequirementDetail
Create a new API Management instanceContributor or Owner on the target resource group (or subscription)
Manage an existing instanceAPI Management Service Contributor (or Owner) on the instance
Foundry portal accessFor example Foundry Account Owner or Foundry Owner on the Foundry resource
Use existing APIM listSame Microsoft Entra tenant and same subscription as the Foundry resource; you have at least API Management Service Contributor on it; created in one of the v2 tiers
Create newCreates a Basic v2 SKU instance, designed for development and testing with SLA support. For production or higher throughput, consider an existing Standard v2 or Premium v2 instance
Private Foundry resourceIf public network access is disabled, use a Standard v2 or Premium v2 instance with a private endpoint, or a Premium v2 instance injected in a virtual network

Defender for AI Services in Defender for Cloud

Threat protection for AI services in Microsoft Defender for Cloud protects Microsoft Foundry workloads on an Azure subscription. It works with Azure AI Content Safety Prompt Shields and Microsoft's threat intelligence to provide alerts for threats such as data leakage, data poisoning, jailbreak and credential theft, and it integrates with Defender XDR so AI workload alerts can be centralized in the Defender XDR portal.

AspectDetail
Release stateGenerally available (GA)
PricingBilling is on the Defender for Cloud pricing page. 30-day free trial, capped at 75 billion tokens scanned; billing begins if the cap is reached within the 30 days
Scanned contentText tokens only. Image and audio tokens aren't scanned
CloudsCommercial clouds: yes. Azure Government: no. Microsoft Azure operated by 21Vianet: no. Connected AWS accounts: no
FeaturesActivity monitoring (security alerts) and prompt evidence (security alerts)

Enable the plan

  1. Enable Defender for Cloud on the Azure subscription. To enable the plan you need Owner or Contributor level (the onboarding article); the overview article says Owner at subscription scope or specific roles with corresponding data actions, so don't rely on the exact role in an answer.
  2. In the Azure portal open Microsoft Defender for Cloud > Environment settings and select the subscription.
  3. On the Defender plans page, toggle AI services to On.
Component (AI services > Settings)What it does
Suspicious prompt evidenceAlerts include suspicious parts of user prompts and model responses, with sensitive data automatically redacted. If it is disabled, analysis of prompts and responses for threat detection continues but the prompt content is masked in alerts
Data security for AI interactionsLets Microsoft Purview access and analyze prompts, responses and metadata (SIT classification, auditing, insider risk, communication compliance, eDiscovery). It is a paid Purview feature that requires a Microsoft Purview license and is not included in the Defender for AI Services plan
AI model securityModel scanning gives a unified view of models registered in Azure Machine Learning registries and checks for issues such as serialization vulnerabilities, malware and missing scans

AI security posture (Defender CSPM) and alerts

Foundry guardrails for models and agents

A guardrail is a named collection of controls. Each control defines a risk to detect, the intervention points to scan, and the action to take. Risks are flagged by classification models from Azure AI Content Safety. Agent guardrails are in preview. One guardrail can be applied to one or many models and agents in a project.

Intervention pointWhat is scannedModelsAgents
User inputThe prompt sent to a model or agentYesYes
Tool call (Preview)The action and data the agent proposes to send to a toolNoYes (Preview)
Tool response (Preview)The content returned from a tool to the agentNoYes (Preview)
OutputThe final completion returned to the userYesYes

Create and assign a guardrail

  1. Role: Foundry Account Owner or higher on the Azure AI resource.
  2. In your project select Build, then the Guardrails page, then Create Guardrail (Step 1: Add Controls).
  3. Select a risk, choose intervention points and one action, then Add control.
  4. Select Next (Step 2) and choose agents and models to assign, then Next (Step 3: Review). Name the guardrail and select Create.

Data and AI security dashboard

The Data and AI security dashboard in Defender for Cloud gives one place to monitor data and AI resources, their risks and protection status. It highlights critical issues, resources that need attention and internet-exposed resources, and it combines attack paths, recommendations and data threat analysis. It is enabled at the subscription level and shows data based on the plans enabled in the subscription.

RequirementDetail
Plans for full accessDefender CSPM plan, and its sensitive data discovery extension, Defender for Storage, Defender for Databases, and threat protection for AI workloads
Resource providerRegister each relevant Azure subscription to the Microsoft.Security resource provider
PermissionsMicrosoft.Security/assessments/read, Microsoft.Security/assessments/subassessments/read, Microsoft.Security/alerts/read
Minimum roleSecurity explorer (minimum required privileged RBAC role)
SectionWhat it shows
Data and AI security overviewResources by cloud: storage assets, managed databases, hosted databases (IaaS) and AI services; which are fully, partially or not protected by Defender CSPM, Defender for Storage, Defender for Databases and AI threat protection
Top issuesResources needing the most immediate attention: highest-severity alerts by MITRE ATT&CK tactic, and critical and high recommendations and attack paths
Data closer lookSensitive data discovery, data threat protection, data queries in security explorer, internet exposed data resources
AI closer lookAI discovery, AI threat protection (prompts scanned and alerts by severity), AI queries in security explorer (for example sensitive data used for grounding), internet exposed resources used for grounding

Foundry agent data will no longer appear in the Data and AI dashboard or in Cloud Security Explorer, per the Agent 365 transition article.

Troubleshooting: why is it still exposed?

SymptomLikely causeFix
Existing API Management instance not listed for AI GatewayNot a v2 tier, a different tenant or subscription, or you lack API Management Service ContributorUse a v2 tier instance in the same tenant and subscription with the right role
Permission error creating the gatewayMissing Contributor or Owner on the resource group (to create)Assign the role, or use an existing instance with API Management Service Contributor
Older project bypasses the gatewayExisting projects aren't added automaticallyAdd project to gateway; check Gateway status is Enabled
Token limits don't applyLimits not configured, or the project isn't using the gatewayEnable the project for the gateway, then configure limits on Manage > AI Gateway
500 errors right after gateway setupAuto-created endpoints still provisioning or model deployment not mappedWait several minutes, test without the gateway, check API Management logs; remove and re-add the project
Prompt snippets masked in Defender alertsUser prompt evidence is off (analysis still runs)Turn on Enable user prompt evidence
Tool controls in a guardrail do nothingTool isn't on the moderation list, or the control is for a risk not supported for agentsUse a supported tool or a supported risk; remember the agent guardrail overrides the model's
Dashboard incompletePlans not enabled, resource provider not registeredEnable Defender CSPM and related plans; register Microsoft.Security

CLI and PowerShell

TaskAzure CLIPowerShell
Install the Az PowerShell modules (troubleshooting Purview data security for AI interactions)-Install-Module -Name Az -AllowClobber
Connect to Azure PowerShell as a tenant admin-Connect-AzAccount -Tenant $yourTenantIdHere
Check that the Microsoft Purview service principal exists in the tenant-Get-AzADServicePrincipal -ApplicationId "9ec59623-ce40-4dc8-a635-ed0275b5d58a"
Add the Microsoft Purview service principal to the tenant-New-AzADServicePrincipal -ApplicationId "9ec59623-ce40-4dc8-a635-ed0275b5d58a"

Exam Tips

Tick each tip once you can answer it without looking.

“Foundry AI Gateway: existing APIM instance missing from the list” → It must be a v2 tier, in the same tenant and subscription as the Foundry resource, with API Management Service Contributor or Owner on it. Trap: Create new makes a Basic v2 instance (dev and test); for production use an existing Standard v2 or Premium v2.

“Roles to create the gateway” → Contributor or Owner on the target resource group or subscription, plus Foundry Account Owner or Foundry Owner for portal access. Trap: API Management Service Contributor is for managing an existing instance, assigned on that instance.

“Project created before the gateway still bypasses it” → Manage > AI Gateway, select the gateway, Add project to gateway. Trap: New projects are enabled by default; existing ones aren't. Token limits don't apply if the project isn't using the gateway.

“Stop AI Gateway charges” → Delete the gateway from the Foundry resource, then delete the API Management instance. Trap: Disabling or removing projects leaves the gateway and its charges in place.

“AI gateway token policy responses” → 429 Too Many Requests for the tokens-per-minute limit; 403 Forbidden for the total token quota. Trap: llm-content-safety also returns 403 when it blocks malicious content.

“API Management calls to Azure AI Content Safety fail” → Backend uses Managed Identity (resource ID https://cognitiveservices.azure.com) and the API Management managed identity has the Cognitive Services User role on the Content Safety service. Trap: The backend URL must look like https://<name>.cognitiveservices.azure.com, not an OpenAI endpoint with an API key.

“AI gateway security features: no API keys, moderated prompts” → Managed identities, credential manager OAuth, and Azure AI Content Safety policies. Trap: Semantic caching is performance; circuit breakers are resiliency.

“Turn on threat protection for AI services” → Defender for Cloud > Environment settings > subscription > Defender plans > AI services On (GA). Trap: Text tokens only are scanned; the 30-day trial is capped at 75 billion tokens, then billing begins; not available in Azure Government or 21Vianet.

“Defender for AI alerts show masked prompt text” → Enable user prompt evidence in the plan settings; detection already runs. Trap: Data security for AI interactions is a different, Purview toggle.

“Data security for AI interactions toggle” → Needs a Purview license (not in the Defender for AI Services plan); excludes Foundry agent data; policies need Entra ID auth with user context. Trap: Other calls show only in Purview Audit and DSPM for AI Activity Explorer.

“Foundry guardrail: agent guardrail vs model guardrail” → The agent's guardrail fully overrides the model's; risks are detected from the guardrail the agent is assigned. Trap: Tool calls and tool responses aren't scanned for a risk unless the agent's guardrail has a control there.

“Foundry guardrail intervention points” → User input, Tool call (Preview), Tool response (Preview), Output; tool points are agents only. Trap: Tool controls need a tool with moderation support; otherwise they don't take effect. Agent guardrails are in preview; agents use only Annotate and block.

“Edit a Microsoft Default guardrail or a Violence input control” → Default.V2 can't be edited; create your own guardrail, and override undeletable controls by adding a control for the same risk. Trap: Blocking level Low blocks only high-severity content; High is most restrictive.

“Which role creates Foundry guardrails?” → Foundry Account Owner or higher. Trap: The roles were renamed from Azure AI Account Owner; role IDs and permissions are unchanged.

“Data and AI security dashboard prerequisites” → Defender CSPM plan (plus related plans), Microsoft.Security resource provider registered per subscription, minimum role Security explorer. Trap: It is enabled at the subscription level, not tenant level; Foundry agent data will no longer appear after the Agent 365 transition, per the transition article.

Sources

Checked against Microsoft Learn on November 13, 2026.

← AI Data Risk & Agent IDServer & VM Security →