Integration · CI/CD

Masked and synthetic test data in Azure Pipelines

Add a stage that prepares test data before your QA tests: the pipeline starts Synthesized masking or generation workflows through the REST API, waits for them, and only then runs the tests. The pipeline never touches the databases itself.

Azure DevOps and Synthesized at a glance

As described in the Synthesized documentation for Azure DevOps.

How it connectsA Bash step runs a script that calls /external/api/v1 with the X-Access-Key header: health check, start the workflow, poll its status, fetch logs on failure, stop it on timeout.
Where secrets liveA variable group, synthesized-tdk, under Pipelines › Library, with X_ACCESS_KEY marked as secret so it is masked in logs.
Pipeline shapeStage 1, Prepare test data: preflight, mask production to test, generate synthetic data. Stage 2, Run QA tests: depends on stage 1 and publishes JUnit results.
ScheduleA schedules block with 0 5 * * 1-5 runs at 05:00 UTC on weekdays, on main, even without code changes (always: true).
AgentsThe documented example uses a Microsoft-hosted ubuntu-latest agent. The agent must reach Governor over HTTPS.

Set it up

1. Build the workflows in Governor

Create a masking workflow, a generation workflow, or both, and run each once by hand. Note their workflow IDs.

2. Create the variable group

Add synthesized-tdk under Pipelines › Library with GOVERNOR_BASE_URL, X_ACCESS_KEY (secret), MASK_WORKFLOW_ID and GENERATE_WORKFLOW_ID. Scope the key to the QA workflows and lock the group to the right environment.

3. Add the script

Commit run-synthesized-workflow.sh to the repository. It needs curl and jq, both on the hosted Ubuntu image.

4. Add the stages

Run the data stage first and make the test stage depend on it, so tests run only after the data is ready.

Example pipeline

A trimmed version of the documented pipeline: one masking job, then the tests. The docs add a preflight health check, a synthetic generation job and skip parameters.

azure-pipelines.yml

trigger: none
 
schedules:
- cron: "0 5 * * 1-5"
displayName: Weekday test data refresh
branches:
include:
- main
always: true
 
variables:
- group: synthesized-tdk
 
pool:
vmImage: ubuntu-latest
 
stages:
- stage: PrepareTestData
displayName: Prepare test data
jobs:
- job: MaskProdToTest
steps:
- bash: sh ./scripts/run-synthesized-workflow.sh
displayName: Run Synthesized masking workflow
env:
GOVERNOR_URL: $(GOVERNOR_BASE_URL)
GOVERNOR_ACCESS_KEY: $(X_ACCESS_KEY)
WORKFLOW_ID: $(MASK_WORKFLOW_ID)
 
- stage: RunQATests
displayName: Run QA tests
dependsOn: PrepareTestData
jobs:
- job: Tests
steps:
- script: npm ci && npm test
- task: PublishTestResults@2
inputs:
testResultsFormat: JUnit
testResultsFiles: "**/junit*.xml"

scripts/run-synthesized-workflow.sh

#!/bin/sh
# run-synthesized-workflow.sh: start a Synthesized workflow and wait for it.
# Needs GOVERNOR_URL, WORKFLOW_ID and GOVERNOR_ACCESS_KEY; uses curl and jq.
set -eu
API="$GOVERNOR_URL/external/api/v1"
AUTH="X-Access-Key: $GOVERNOR_ACCESS_KEY"
TIMEOUT_SEC="${TIMEOUT_SEC:-1800}"
 
RUN=$(curl -sSf -X POST -H "$AUTH" "$API/workflow/$WORKFLOW_ID/run")
RUN_ID=$(printf '%s' "$RUN" | jq -r '.workflow_run_id')
echo "Started workflow run $RUN_ID"
 
WAITED=0
while [ "$WAITED" -lt "$TIMEOUT_SEC" ]; do
RUN=$(curl -sSf -H "$AUTH" "$API/workflow-run/$RUN_ID")
STATUS=$(printf '%s' "$RUN" | jq -r '.workflow_run_status')
case "$STATUS" in
COMPLETED) echo "Test data ready"; exit 0 ;;
FAILED|STOPPED)
echo "Run $RUN_ID ended as $STATUS: $(printf '%s' "$RUN" | jq -r '.error_message')"
curl -sS -H "$AUTH" "$API/workflow-run/$RUN_ID/logs" | tail -n 50
exit 1 ;;
esac
sleep 10
WAITED=$((WAITED + 10))
done
echo "Timed out after $TIMEOUT_SEC seconds; stopping workflow $WORKFLOW_ID"
curl -sS -X POST -H "$AUTH" "$API/workflow/$WORKFLOW_ID/stop" || true
exit 1

The documented script also checks GET /healthy first and writes the run ID to the synthesizedRunId output variable for later steps.

Things to know

Use a dedicated key

An access key carries the permissions of the Governor user who generated it. Create a user that can reach only the workflows this pipeline runs, generate the key as that user, and give it a short expiry: keys are chosen from 1 hour to a year, and the docs say they can't yet be revoked.

One output database per environment

Two runs can't write to the same output database at the same time. If parallel pipelines or branches need data, give each environment its own workflow or output database.

Where the data goes

Workers read the source, mask, subset or generate, and write the target. Database contents stay with the workers and aren't sent to Governor, which, like the pipeline, only sees run status, logs and configuration. Run Synthesized on-premises, including air-gapped, and the data never leaves your environment; it is also available as SaaS.

Questions about Azure DevOps and Synthesized

Is there an Azure DevOps extension?

No extension is needed. A Bash step calls the Synthesized REST API with curl and jq; the Synthesized docs publish the pipeline and the script.

How do I keep the access key out of the logs?

Store it in the synthesized-tdk variable group as a secret variable. Azure Pipelines masks secret values in logs, and you pass them to the script explicitly through env.

Can I reuse data that's already masked?

Yes. The documented pipeline has boolean parameters, skipMasking and skipGeneration. Re-run with one of them set and the skipped job shows as Skipped in the run graph.

Can it run for every pull request?

Yes. Swap trigger: none for a pr trigger on main. Two runs can't write to the same output database at once, so give pull-request pipelines their own workflow or output database.

Why is my first run queued on a Microsoft-hosted agent?

New organizations need Microsoft's free-tier parallelism grant before hosted agents run, which can take a few business days. A self-hosted agent also works, and is the usual choice when Governor is internal.

Try it on one pipeline

Bring one Azure pipeline that waits on test data, and see a Synthesized workflow refresh it before the QA stage.

Updated November 2026

Azure DevOps and Azure Pipelines are trademarks of Microsoft Corporation. All other product names are trademarks of their respective owners.