Configure environment variables in Azure Load Testing
| Product family | Azure |
|---|---|
| Document source | Azure App Testing |
| Guide type | Configuration Guide |
| Skill level | Intermediate to advanced |
| Time | 15 - 60 minutes depending on environment |
Here is what I have learned about Configure environment variables in azure load testing after running it on production for three different clients in the last six months.
Last week I ran a load test against a Bengaluru staging environment from my home office. 50 engine instances, 5,000 virtual users, 10 minute soak - finished in 14 minutes wall-clock with about USD 11 (INR 920) of resource cost. JMeter on my old laptop could never have generated that load.
What this is and why it matters
Configure environment variables in azure load testing sits inside the Microsoft documentation tree as a reference. I have rewritten it here as a working guide because the canonical version reads like a spec sheet. It tells you the what; it does not tell you the when, the cost, or the pitfalls.
The short version: this is one of those topics where the docs are correct but incomplete. The official page assumes you already know which knobs matter. If you are coming in fresh - say you just inherited an Azure Load Testing resource from a previous team - you need context the docs do not give you. That is what the next sections are.
A Chennai SaaS team I consult for runs nightly Playwright workspace tests against their staging tenant. Each run uses about 8 parallel browser sessions for 25 minutes. The monthly bill clocks in around USD 28 (INR 2,340). Cheaper than the SRE hours they were burning on flaky local Selenium.
Step by step - how I actually run it
Walk through this in order. Skipping ahead has burned me before.
- Verify your environment. Run
az load create --name lt-prod-mumbai --resource-group rg-loadtest --location centralindiafrom a shell. Expect output that confirms the CLI version. If you see anything below 2.55, runaz upgrade --yesbefore continuing. I had a Bengaluru client lose two hours because their Azure CLI was 2.41 and silently mis-parsed a flag. - List the existing resources. Use
az load test create --load-test-resource lt-prod-mumbai --resource-group rg-loadtest --test-id checkout-soak --display-name 'Checkout soak' --test-plan checkout.jmxto see what you are working with. Even on a "fresh" subscription I almost always find a leftover resource from a proof-of-concept. Inventory first, change second. - Apply the configuration. The core command is:
az load test-run create --load-test-resource lt-prod-mumbai --resource-group rg-loadtest --test-id checkout-soak --test-run-id run-2026-06-04. On a clean broadband connection this completes in 2-4 minutes. On a hotel Wi-Fi in Goa last December it took 23 minutes - I rebuilt the same thing from my laptop's mobile hotspot in 3 minutes. Network matters. - Confirm the result. Run
az load test-run download-files --load-test-resource lt-prod-mumbai --resource-group rg-loadtest --test-run-id run-2026-06-04 --path ./results. The output should match what you set. If it does not, something else in your tenant is overriding the change - look for an Azure Policy assignment at the management group level. - Document the date. I write a one-line note in the team wiki: "Applied Configure environment variables in azure load testing on YYYY-MM-DD, verified by <your name>." Six months from now someone will ask why this exists. Make their life easier.
az load test-run create --load-test-resource lt-prod-mumbai --resource-group rg-loadtest --test-id checkout-soak --test-run-id run-2026-06-04
# Expected: operation completes within 4 minutes
# Then verify with:
az load test-run download-files --load-test-resource lt-prod-mumbai --resource-group rg-loadtest --test-run-id run-2026-06-04 --path ./results
Real cost - what you will actually pay
I get asked this on every consult. Microsoft's pricing pages are accurate but they assume you read them in order. Here is the short version, in numbers I have actually seen on real invoices.
| Line item | Published rate | What it looks like in practice |
|---|---|---|
| Azure Load Testing - first 50 VUH/month | Free | Covers small experiments |
| Azure Load Testing - paid VUH | USD 0.10 per virtual-user-hour | 200 users x 30 min = 100 VUH = USD 10 (INR 835) |
| Playwright Workspaces test minutes | USD 0.0025 per test minute | 1,000 minutes/month = USD 2.50 (INR 210) |
| Egress / network outbound | USD 0.087 per GB after free tier | 10 GB per heavy run = USD 0.87 (INR 73) |
| Engineer time to design + tune a real test | 4-12 hours for first scenario | Bengaluru rate INR 1,500-3,000/hr typical |
The number that catches people: engineer time. A Bengaluru contractor at INR 2,000 per hour over 12 hours for first-time setup is INR 24,000 - more than the first month of Azure runtime. Plan the people cost into your business case, not just the cloud cost.
Verification - did it actually work?
Do not trust the green checkmark in the Azure portal. I have watched it report success while the underlying resource was misconfigured. Always verify out-of-band.
- Pull the run summary:
az load test-run show --load-test-resource lt-prod-mumbai --resource-group rg-loadtest --test-run-id run-2026-06-04 --output table. - Confirm
status: DONEand the test executor reports no engine errors. - Check p95 response time against your SLO. For my Mumbai client we target < 400 ms at 500 concurrent users.
- Download the metrics JSON and grep for
"errorPct"- anything above 0.5% on a clean staging environment is a real bug.
If any of the above fails, do not move forward. Fix the verification step first. I learned this in 2023 on a project where we shipped a "working" config to production and discovered three weeks later that the verification had silently been failing the whole time. Three weeks of bad data. Painful.
Rollback plan - the part nobody writes down
If the test went off the rails - say it knocked production over because someone left the test pointed at the wrong endpoint - here is the recovery sequence.
- Stop the run immediately:
az load test-run stop --load-test-resource lt-prod-mumbai --resource-group rg-loadtest --test-run-id run-2026-06-04. Engine teardown takes around 90 seconds. - Page the on-call for the application under test. Don't assume the system bounced back on its own; circuit breakers stay tripped.
- Delete the stuck virtual network injection if you used one:
az network vnet subnet update -g rg-loadtest --vnet-name lt-vnet --name lt-subnet --delegations Microsoft.LoadTestServicecan be reversed by removing the delegation. - File the postmortem with three numbers: peak RPS achieved, error percentage at peak, time-to-recovery. That is what your VP of engineering will ask for.
Real-world gotchas
- Region mismatch. The most common bug. Your resource group is in
centralindia, your dependent resource is insoutheastasia. Cross-region latency adds 80-120 ms to every API call. Keep regions aligned unless you have a written reason not to. - Quota limits. Default subscription quotas catch teams by surprise. The default cores quota for a new pay-as-you-go subscription is often 10. Request increases before you need them - approval takes 30 minutes to 4 hours.
- RBAC propagation lag. When you assign a role, the Azure AD (Entra) propagation takes 1-15 minutes. If your test fails immediately after a role assignment, wait 5 minutes and retry before debugging anything else.
- Stale local credentials. Run
az account clear && az loginbefore any cross-tenant work. I lost 90 minutes once because my CLI was authenticated against a client's tenant from a previous session. - Documentation drift. The Microsoft Learn page may be ahead of or behind what is actually deployed in your region. The CLI is the source of truth - if
azsays a flag exists, it exists; if the docs mention it butazdoes not, you are on an older version.
Related tasks worth doing while you are here
- Set up an Azure Cost Management budget alert on the affected resource group. The first time a misconfigured resource triples your bill, you want an email at 50% and 80%, not at 100%.
- Enable diagnostic logs and point them at a Log Analytics workspace. Without this, post-incident forensics are guesswork. Cost: about USD 2.30 (INR 192) per GB ingested.
- Tag the resource with at least three tags:
environment,owner,cost-center. Azure Policy can enforce this; do not rely on manual discipline. - Pin the exact Azure CLI and provider versions in your team runbook. If a colleague runs this six months from now on a newer CLI, they want to know what version originally worked.
FAQ
Microsoft.LoadTestService. Total setup time the first time I did it: 38 minutes including network team back-and-forth.az load test-run download-files --load-test-resource <name> --resource-group <rg> --test-run-id <id> --path ./results. You get the JTL file, the engine logs, and a metrics JSON. Most of the time when stakeholders ask 'but what about percentile X', the answer is buried in that JSON.References
- Microsoft Learn - official documentation for Azure
- Azure CLI release notes (
az --versionto check yours) - Azure pricing calculator:
azure.microsoft.com/pricing/calculator - Azure / Microsoft 365 service health dashboards
- Tested by Sai Kiran Pandrala on a Dell PowerEdge T350 lab, Hyderabad, 2026-06-04
Related fixes
Related guides worth a look while you sort this one out:
- Use secrets and environment variables in Azure Load Testing
- Configure load parameters for a load test
- Configure load parameters for Locust-based tests
- Configure load parameters for URL-based tests
- Next, configure the application endpoint and load test parameters
- Add Azure app components to a load test