How garak scans an Azure OpenAI deployment
A security team that is about to release a model deployment in Azure OpenAI needs an independent view of how that deployment responds to hostile prompts, and the scan has to test the deployment as applications and users actually reach it. garak's Azure generator covers this case. It supports chat and chat completion models, and it reads three environment variables: AZURE_API_KEY for the key, AZURE_ENDPOINT for the resource endpoint, and AZURE_MODEL_NAME for the model name. The generator sends probe prompts to the endpoint you name, so the scan exercises the deployment's own configuration rather than a copy of the underlying model. Confirm with your Azure administrator which endpoint and deployment name production traffic uses, because a scan pointed at a different deployment will produce results that do not describe the release candidate.
garak is an Apache 2.0 licensed command-line tool, so the scan itself needs no vendor license, but the work around it does. Someone must install the tool with Python 3.11 or newer, store the key in a secrets manager and inject it at run time, choose the probes, and decide where the JSONL report and garak.log file are kept and who may read them. Keep the API key out of the command history, shell scripts and the report directory, because the report records the attempts and responses. DeployOpen plans and runs this scan inside the client's own environment, with the key handling, network path to the endpoint and storage of results agreed in writing before the first probe is sent.
What you need before the first Azure scan
A garak run against Azure OpenAI depends on four things being in place before the first probe fires: a scan host with garak installed, an Azure OpenAI deployment the scanner is allowed to call, the endpoint and key handed to garak safely, and a network path from the host to Azure. Confirm each one before you spend time on probe selection.
Python and garak installed
Install garak from PyPI with pip on a host running Python 3.11 or newer. garak is developed on Linux and macOS, so a Linux scan host is the lowest-friction choice. Pin the garak version you tested with, because scores and report fields can shift between releases. Record the installed version in your scan notes so later comparisons against the same Azure deployment stay valid.
garak on PyPIAzure OpenAI resource and deployment
garak calls a named deployment in an Azure OpenAI resource, so you need the resource, the deployment and the model behind it. Confirm the deployment is a chat or chat completion model, since the generator supports those types. Give the scanner account permission to call that deployment and nothing broader, so a leaked key cannot reach other resources in the subscription.
Endpoint and key handling
The Azure generator reads the key from AZURE_API_KEY, the endpoint from AZURE_ENDPOINT and the model name from AZURE_MODEL_NAME. Set these as environment variables on the scan host or in your secrets manager, and keep them out of config files committed to source control. Use a key scoped to the scan purpose and plan a rotation step after each engagement.
Network route to Azure
The scan host must reach the Azure OpenAI endpoint over HTTPS. If your Azure resource is reachable only through a private endpoint or behind a corporate proxy, the scan host needs a route to that private address and any proxy settings must be in place. Test the route with a single request before a full run, and confirm with your network team which egress rules apply to the scan host.
API version and model support
Confirm the API version your deployment uses and that it supports the request shape the generator sends. Check Microsoft's current Azure OpenAI documentation for the versions and model types available in your region, and check the generator source for the model types garak handles. Do this before the first run, because a mismatch often shows up as failed requests that look like probe results.
Configuring the Azure generator step by step
This sequence takes you from a clean install to a full garak run against an Azure OpenAI deployment, with a connectivity check before any large probe selection. Each step ends with a result you can confirm in the output files.
Install garak on a controlled host
Install garak from PyPI with pip in a Python environment running Python 3.11 or newer, on a Linux or macOS host that your team controls. Run the installation from a virtual environment so the version is pinned and repeatable across scan hosts. Confirm the install by running garak's help command from the shell and checking that it lists the available options without errors.
Set the Azure API key and endpoint
Export AZURE_API_KEY with the key for the Azure OpenAI resource and AZURE_ENDPOINT with the resource endpoint URL. Store these in your secrets manager or a restricted shell profile rather than in a config file committed to source control. Confirm the variables are set in the scanning shell without printing the key, for example by checking that the variable is non-empty.
Set the Azure model name to your deployment
Set AZURE_MODEL_NAME to the name of the deployment you want to test, which is the deployment name you chose in Azure rather than a generic model family name. The model name must match the deployment exactly, or requests fail with a not-found error. Confirm the value against the deployment list in your Azure resource before you start a scan.
Choose the chat or chat completion target type
Select the Azure generator's chat or chat completion target type to match the deployment. Chat models take conversation-style messages, while chat completion models take the prompt format the deployment expects. Confirm the choice against the model's documentation in your Azure resource, because a mismatched target type produces errors or misleading results rather than a clean failure.
Run one low-volume probe as a connectivity check
Run a single, small probe against the deployment with the generation count kept low, so you test authentication, endpoint reachability and the deployment name before spending a full scan on them. Use the probe list command to pick one probe with a short prompt set. Confirm success by finding at least one completed attempt in the JSONL report and no authentication or resource-not-found errors in garak.log.
Run the full probe selection with content filters in place
Run the probe selection you planned, against the same deployment with its Azure content filters left enabled, so the results reflect what your users will actually meet. Record the filter configuration and deployment name in your run notes so the results can be repeated later. Confirm the run by checking that the JSONL report covers every planned probe and that the summary lists a result for each one.
Review the logs and report before trusting results
Read garak.log for warnings and repeated errors such as rate limiting or content filter rejections, and confirm that filter blocks are recorded as blocks rather than being scored as model failures. Check the JSONL report for empty or truncated responses that would distort the failure rate. Confirm the review by noting any anomalies in the run record before you share results with reviewers.
How a garak attempt reaches Azure and returns through the content filter
The run starts in the garak harness, where each probe's prompt is sent through the Azure OpenAI generator, which reads AZURE_API_KEY, AZURE_ENDPOINT and AZURE_MODEL_NAME. The request crosses the boundary from your scan host to the Azure OpenAI endpoint, where the deployment's content filters may block or alter the prompt or the completion before anything returns. The reply then goes to the detector, which scores it, and the attempt is written to the JSONL report and garak.log. Check that filtered responses are recorded as outcomes you can interpret, not silently dropped.
Trust boundary between the scan host and the Azure OpenAI resource, with the content filter in the return path.
Testing with content filters on versus off
Testing with the production content filter configuration in place measures what a user of the deployment can actually reach. Requests pass through Azure's content filtering before and after the model call, so a probe that the model would answer but the filter blocks does not produce the output a user would see. This is the configuration to use when the question is whether the application, as deployed, lets a harmful or sensitive output through.
- Reflects real exposure: The result describes the deployed system, including the filter, the deployment settings and any application logic in front of it.
- Blocked attempts are still evidence: Filter refusals show that a probe category was caught, but they do not show the model would refuse without the filter.
- Filter changes move results: Raising or lowering a filter severity threshold later can change pass and fail rates on the same probes.
- Record the filter settings: Note the filter policy name, thresholds and any custom blocklists alongside the scan so the result can be reproduced.
- Confirm the settings with your Azure team: Filter options and their names depend on the Azure OpenAI resource and API version in use, so check them in your own environment.
Before you read a pass result as proof of safety, confirm that the filter configuration in the scan record matches the configuration in production on the day of the run.
A model-only evaluation uses a separate configuration with the content filters relaxed or removed, so the scan shows how the underlying model responds to a probe. Teams use it to learn where the model's own safety behavior is weak, which tells them where a filter or an application control is carrying the load. It answers a different question from the production test, and its results should not be presented as the production exposure.
- Shows model behavior: Failures here indicate what the model will produce when nothing upstream intervenes.
- Informs defense in depth: A model that fails often without filters needs other controls, such as system prompt design, tool permissions or output checks.
- Requires a controlled environment: Relaxed filter settings should be limited to test resources, with access restricted and the change logged.
- Keep the two runs separate: Store the filtered and unfiltered reports under distinct names so comparisons are not confused later.
- Ask what the vendor permits: Confirm with Azure which filter modifications your subscription and resource type allow, because the options and approval steps are set by the provider.
When you report a model-only result, state plainly that the filters were off and why, so readers do not read it as the production posture.
The two configurations produce results that answer different questions, so they should be read side by side rather than merged into one score. A probe that fails only with filters off tells you the filter is doing protective work. A probe that fails with filters on means something got through the production configuration, which is the more urgent finding. Each result needs a clear label that names the configuration it came from.
- Failing with filters on: Treat this as a finding against the deployment and prioritize it for review and remediation.
- Failing only with filters off: Record it as a dependency on the filter, and consider whether that dependency is documented and monitored.
- Passing in both: Gives the strongest signal for the probes tested, though coverage still depends on the probe selection.
- Differences between runs: Compare runs only when the model version, filter settings and garak version match, since each change can shift the rates.
- Confirm how your report labels configurations: Check the garak report fields and your own naming convention so each run identifies its filter state clearly.
Write the conclusion in terms of the configuration tested, not the model in general.
The filter setup is part of the scan result. Without it, a later reader cannot tell whether a pass reflects a strict filter, a permissive one or a configuration that changed after the run. Record the setup at the time of the scan and keep it with the report files, so that the evidence stays meaningful when someone reviews it months later.
- Filter policy identity: Record the policy or configuration name attached to the deployment and the date it was applied.
- Thresholds and custom lists: Capture severity thresholds and any custom blocklists or allowlists, since these decide what the filter blocks.
- Deployment and model details: Note the deployment name, model version and API version used for each run, along with the garak version.
- Scan identity: Store the configuration file and command with the JSONL report and the garak log so the run can be repeated.
- Ask for a change history: Confirm with your Azure administrators how filter changes are logged and who approves them, so the record can be checked.
Before sign-off, check that each report carries its filter state and that the stored settings match the environment that was tested.
Mapping garak variables to Azure OpenAI settings
This table maps each garak setting for the Azure OpenAI generator to the Azure resource value it expects and the place in the Azure portal where you confirm it. Read it before writing the environment file, because a mismatch between the deployment name and the model family is the most common cause of failed scans.
| garak setting | Azure value to use | Where to confirm it | Common mistake |
|---|---|---|---|
| AZURE_API_KEY | A key for the Azure OpenAI resource | Resource management, keys and endpoint in the Azure portal | Using a key from a different resource or a rotated key |
| AZURE_ENDPOINT | The resource endpoint URL for the Azure OpenAI resource | Resource overview or keys and endpoint page in the Azure portal | Pasting the full deployment path instead of the resource base endpoint |
| AZURE_MODEL_NAME | The deployment name you created in Azure OpenAI | Deployments page of the Azure OpenAI resource in the Azure AI Foundry or Azure portal | Entering the underlying model family, such as a model version name, instead of the deployment name |
| Target type (chat or chat completion) | Chat for chat models, chat completion for completion models, as the generator supports both | Model card and deployment details for the model you deployed | Choosing a target type that does not match the model behind the deployment |
| Content filter settings | The filter configuration applied to the deployment under test | Content filters section of the Azure portal for the deployment | Scanning with filters changed or removed, so results do not reflect production |
| Environment scope | Variables set in the shell or CI job that runs garak | Your run environment, not the Azure portal | Leaving a key from a test run in shared shell history or logs |
Protecting keys, logs and reports during an Azure scan
An Azure OpenAI scan touches three kinds of sensitive material: the API key that opens the deployment, the prompts and responses that garak logs, and the reports that summarize the results. The cards below cover where each of these lives during a run and who can reach them afterward. Treat the key, the logs and the scan host as one controlled unit.
Keep the API key out of history
Set AZURE_API_KEY from a secrets manager or a protected environment file at run time, not as an inline export typed into a shared terminal. Shell history, process listings and CI logs can all capture a key that is passed on the command line. Before the first run, confirm that the variable is read from the environment and never written into a garak configuration file that gets committed.
Keep endpoint settings out of source control
The endpoint and model name are read from AZURE_ENDPOINT and AZURE_MODEL_NAME, so they can live in the environment rather than in the repository. Committing a config file that embeds a live endpoint or key makes the secret visible to everyone with repository access and to every fork. Add any local env file to .gitignore and scan the commit history for accidental keys before the repository is shared.
Scope the scanning identity to one deployment
Use a key or identity that can reach only the Azure OpenAI deployment under test, not every resource in the subscription. If the key grants wider access than the scan needs, a leaked scan host exposes other models and data. Ask your Azure administrator to confirm which access mechanism your tenant uses and to record who can rotate the key. Rotate it after the engagement ends.
Review garak.log before sharing
garak.log is continued across runs and records debugging detail, which can include request and response text. Before you send the file to a vendor, ticket or colleague, search it for pasted sensitive content, for example customer records used as probe seeds, and for the key value itself. Redact or delete the file if it contains material you would not share outside the team.
Review JSONL reports for prompt content
Each run writes a JSONL report with every attempt and its evaluation, so the prompts and the model's outputs appear in full. A failing attempt may quote sensitive text the model produced. Review the report before it leaves the scan host, limit who can open it, and keep it in the same access-controlled store as the rest of your AI security evidence.
Restrict the scan host
Run garak from a host that only your security team can log into, with outbound traffic limited to the Azure endpoint and package sources. Keep the key out of world-readable files and delete run directories once reports are archived. Confirm with your platform team how the host is patched, which accounts hold sudo rights and where logs are shipped, since those settings determine who can read the key and the outputs.
Why an Azure OpenAI scan fails and how to fix it
This table lists the failures teams most often hit when pointing garak at an Azure OpenAI deployment, with the likely cause and the fix for each. Read it when a first run errors out or reports results that look wrong, and check the rows in order, since endpoint and naming problems block everything downstream.
| Failure | Likely cause | Fix |
|---|---|---|
| Connection or 404 errors on first call | Endpoint set to the portal page or a path with extra segments instead of the resource base URL | Set AZURE_ENDPOINT to the resource root only, then confirm the URL with a single manual request before running probes |
| Deployment not found | The deployment name was replaced with the underlying model name, such as a model family label | Set AZURE_MODEL_NAME to the deployment name you created in your Azure resource, and confirm it matches the Azure portal exactly |
| Authentication failed (401 or 403) | Key copied from another resource, expired, or regenerated after the variable was set | Export AZURE_API_KEY from the resource that hosts the deployment, then rotate and reload the shell environment |
| Scan runs but every attempt errors | Generator target type does not match the deployment, for example a completion-only model used with the chat path | Confirm whether the deployment serves chat or completion and select the matching Azure generator type before scanning |
| Scores look too clean, many refusals | Azure content filter blocked the prompt and returned a filtered response that garak reads as a refusal | Check the raw attempts in the JSONL report for filter markers, and record filter settings alongside results so the scan reflects what you intend to test |
| Rate limit responses (429) | Probe volume exceeds the deployment's tokens-per-minute or requests-per-minute quota | Lower parallel attempts, reduce generations per prompt from the default of 5, and confirm quota limits with your Azure administrator |
| Timeouts or blocked connections | Corporate proxy, egress firewall or private endpoint rules block the scanning host from the Azure hostname | Allow outbound HTTPS to the resource hostname from the scan host, or run the scan from a network path your network team has approved |
Questions teams ask before scanning Azure OpenAI
Does garak cost anything to run against Azure OpenAI?
garak is a free tool. The maintainers describe it as free, and it is licensed under Apache 2.0, so the software itself carries no license fee. Your spending comes from Azure consumption, because every generation sent to your deployment is billed under your Azure subscription, and from the staff time needed to configure, run and triage the scan. Confirm current Azure OpenAI pricing for your region and model in the Azure portal before you plan the probe volume.
What drives the cost and length of a garak scan on Azure?
Three things dominate. The first is scan volume: garak makes 5 generations per prompt by default, so the number of probes you select multiplies directly into requests against your deployment. The second is Azure consumption, which depends on the model, the deployment type and the size of prompts and responses. The third is staff time for writing the configuration, choosing probes, reviewing FAIL results and deciding which findings need a fix. Narrowing probes to those that match your application and running a small pilot first are the most reliable ways to control both spend and effort.
How long does the first garak scan against Azure OpenAI take to set up?
The setup itself is short: install garak from PyPI on Python 3.11 or newer, set the Azure variables and run a small probe set. The longer part is preparation. Your team needs a working test deployment, agreed probe selection and a decision on how content filters are configured for the run. Confirm the timeline with your own environment, since access approvals, network rules and filter decisions vary by organization. A written scope with a named test deployment usually removes most of the delay.
What do we need to provide before a garak scan of an Azure deployment?
Plan to provide the following before any probe runs:
- An Azure OpenAI resource and a deployment of a chat or chat completion model, since the garak Azure generator supports those model types.
- An API key, supplied through the
AZURE_API_KEYvariable, and the endpoint, supplied throughAZURE_ENDPOINT, along with the model name inAZURE_MODEL_NAME. - A test deployment separate from production, so probe traffic and logs stay out of live data.
- A written decision on content filter state for the run, including whether you test with filters on, off or both, and who approved it.
- A network path from the host running garak to the endpoint.
Should we keep Azure content filters on during a garak scan?
Test with the filters in place first, because that reflects the configuration your users actually reach. Filter-off runs can be useful as a separate baseline that shows what the underlying model does without the platform's protection, but they should be labeled as such in the report. Record the filter configuration with every run so that results remain comparable when filter settings change. Confirm with your Azure administrator how filters are attached to your deployment, since that determines what you can change for testing.
Can our internal team run garak against Azure OpenAI without outside help?
Yes, a team with Python experience and access to the Azure resource can install garak, set the three Azure variables and run probes. Most internal teams find the first run straightforward and the harder work is interpretation. Expect to need someone who can decide which probes match your application, read the JSONL report and its per-attempt evaluations, and decide which FAIL results represent real exposure. Ask whether your team has capacity for that triage each time the scan is repeated, because repeated scans are where ownership gaps usually appear.
What does garak's Apache 2.0 license allow for commercial use?
garak is licensed under Apache 2.0, a permissive open-source license. It is developed in the NVIDIA GitHub organization, and you should read the license text in the repository yourself to confirm the terms that apply to your use, including attribution and notice obligations when you distribute code. The license covers the tool, not the Azure OpenAI service, which is governed by your Microsoft agreement. Your legal team should review both documents together before results are used in a customer or regulator-facing review.
Does DeployOpen run garak scans against our Azure deployment?
DeployOpen runs security testing of AI systems, including scanning of LLM deployments, and delivers findings with fixes and a retest under a written, fixed scope. Scope, deliverables and timelines are agreed in writing before work starts, and a quote follows from that scope. The result is a report your team can act on, not an audit or certification, since DeployOpen does not issue attestations. Ask for the scope in writing and confirm which Azure access, test deployment and filter decisions you must supply.
What a pass or FAIL means for an Azure deployment
A garak FAIL means at least one of the attempts for a probe produced undesirable output, and the report shows the failure rate across all attempts. By default garak makes 5 generations per prompt, so a probe that fails on one of those five attempts is marked FAIL even if the other four were refused. Read the failure rate, not just the label, and open the JSONL report to see which prompts succeeded and what the model returned. The same run also writes a garak.log file that is appended across runs, so keep the log with the report when you compare results later.
Run the scan twice against the same deployment: once with the content filters in their current configuration and once with the relevant filter settings changed for the test only, if your Azure OpenAI resource and governance allow that. Record the filter configuration for each run, because the difference between the two results is the part of the score that depends on Azure's controls rather than on the model itself. Confirm the exact filter settings, their severity thresholds and who may change them with your Azure administrators before the run, since the content filter behavior is set in the Azure resource and not by garak.
Treat every result as evidence about one configuration on the date it was tested. A PASS on a given day does not certify the deployment, and a later model update, filter change, system prompt edit or garak upgrade can shift scores. Store each report with the deployment name, model version, endpoint region, garak version and filter settings, so an auditor or security reviewer can see what was tested. Independent auditors and certification bodies, not garak or DeployOpen, decide whether that evidence meets a given framework.
How DeployOpen scopes and runs Azure OpenAI scans
DeployOpen approaches garak scans of Azure OpenAI deployments as a fixed-scope engagement: the deployments, content filter settings and report handling are agreed in writing before any probe runs. The work is then set up in your own environment, tested against the deployment as your users reach it, and handed over with the configuration and reports your team needs to rerun it.
How we scope
- Inventory which Azure OpenAI deployments, API versions and applications are in scope for the garak run
- Confirm with your team which content filter configurations are active on each deployment being tested
- Agree in writing which probe families, attempts per prompt and report formats the engagement will deliver
How we build
- Install garak in a controlled host or pipeline environment and set AZURE_API_KEY, AZURE_ENDPOINT and AZURE_MODEL_NAME from your secret store
- Run a baseline scan with the content filters in place, then record which probes trigger and which are blocked
- Check that the chat or chat completion generator type matches each deployment before any results are compared
How we hand over
- Deliver the run configuration, environment setup steps and the JSONL reports with the garak.log debugging file
- Document how each finding maps to the filter settings, deployment and application behavior it came from
- Walk your security and platform teams through reading the failure rates and rerunning the scan
How we support
- Offer a retest after fixes to filter settings, system prompts or application code, using the same probe set
- Provide ongoing rescans and upgrade handling as a retainer when your deployments or garak versions change
- Confirm with us which support and retest terms apply to your scope before the engagement starts

