Run AI Red Teaming Agent in the cloud (preview)
This article refers to the Microsoft Foundry (new) portal.
Items marked (preview) in this article are currently in public preview. This preview is provided without a service-level agreement, and we don’t recommend it for production workloads. Certain features might not be supported or might have constrained capabilities. For more information, see Supplemental Terms of Use for Microsoft Azure Previews.
- Pre-deployment AI red teaming runs on larger combinations of attack strategies and risk categories for a fuller analysis,
- Post-deployment continuous AI red teaming runs that can be scheduled to run at set time intervals
- Agentic-specific risk scenarios to support a minimally sandboxed environment for the AI red teaming run
Prerequisites
- Make sure the connected storage account has access to all projects.
- If you connected your storage account with Microsoft Entra ID, make sure to give managed identity Storage Blob Data Owner permissions to both your account and the Foundry project resource in the Azure portal.
- A Foundry project.
- Azure AI User role on the Foundry project.
Getting started
First, install Microsoft Foundry SDK’s project client, which runs the AI Red Teaming Agent in the cloud.Supported targets
Running the AI Red Teaming Agent in the cloud currently only supports the following:- Foundry project deployments
- Azure OpenAI model deployments
- Foundry Agents (prompt and container agents) in your Microsoft Foundry project as a target.
Configure your target model
You can configure your target model deployment in two ways:Option 1: Foundry project deployments
If you’re using model deployments that are part of your Foundry project, set up the following environment variables:Option 2: Azure OpenAI/Foundry Tools deployments
If you want to use deployments from your Azure OpenAI or Foundry Tools accounts, you first need to connect these resources to your Foundry project through connections.- Create a connection: Follow the instructions in Configure project connections to connect your Azure OpenAI or AI Services resource to your Foundry project.
- Get the connection name: After connecting the account, you’ll see the connection created with a generated name in your Foundry project.
-
Configure the target: Use the format
"connectionName/deploymentName"for your model deployment configuration:
Create an AI red team
Create a red team to hold one or more runs that share a data source and risk categories.- Creates a red team to hold all red teaming runs
- Configures the red team with three built‑in evaluators (Prohibited Actions, Task Adherence, Sensitive Data Leakage).
- A JSON body with the group’s metadata, including ID (save it as
{{red_team_id}}for later).
Get a red team
Use this to verify the red team exists and review configuration (criteria, data source, timestamps).Create (or update) an evaluation taxonomy
To red team for the agentic risk category of prohibited actions, you need to be able to confirm, edit, or update the evaluation taxonomy of prohibited actions generated by the prohibited action red teaming workflow. The next example will generate a JSON file with a generated taxonomy of prohibited actions to be used in dynamically generating the attack prompts to test agentic behavior based on user-approved policy. Once you’ve reviewed and confirmed the taxonomy, it will then be used to create a red teaming run as well as assess the Attack Success Rate (ASR) of the agent outputs.- Creates/updates a taxonomy resource named
{{name}}that:- Defines an agent target and tool descriptions
- Specifies the risk categories of
ProhibitedActions
- via a
file_idURI in the Create Run request.
Create a run in a red team
A run generates items from a source (for example, taxonomy) and red teams the target agent with chosen attack strategies.attack_strategies: For example, “Flip”, “Base64”, “IndirectJailbreak” (choose the ones you want to test)num_turns: multi‑turn depth for generated red‑team itemssource.id: points to your taxonomy by file‑ID URItarget: the agent under test (name, version, tools)
- A run object including
id(save as{{eval_run_id}})
Get a red teaming run (by ID)
Use this to check status of your red teaming run (for example, queued, running, succeeded, failed).The API is synchronous per request, but runs themselves are processed server‑side; poll this endpoint until completion before fetching output items.