Azure

Configure environment variables in Azure Load Testing

By Sai Kiran Pandrala · Last verified: 2026-05-31 · Source: official Microsoft Learn docs

At a glance
Product familyAzure
Document sourceAzure App Testing
Guide typeConfiguration Guide
Skill levelIntermediate to advanced
Time15 - 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.

  1. Verify your environment. Run az load create --name lt-prod-mumbai --resource-group rg-loadtest --location centralindia from a shell. Expect output that confirms the CLI version. If you see anything below 2.55, run az upgrade --yes before continuing. I had a Bengaluru client lose two hours because their Azure CLI was 2.41 and silently mis-parsed a flag.
  2. 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.jmx to 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.
  3. 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.
  4. 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.
  5. 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 itemPublished rateWhat it looks like in practice
Azure Load Testing - first 50 VUH/monthFreeCovers small experiments
Azure Load Testing - paid VUHUSD 0.10 per virtual-user-hour200 users x 30 min = 100 VUH = USD 10 (INR 835)
Playwright Workspaces test minutesUSD 0.0025 per test minute1,000 minutes/month = USD 2.50 (INR 210)
Egress / network outboundUSD 0.087 per GB after free tier10 GB per heavy run = USD 0.87 (INR 73)
Engineer time to design + tune a real test4-12 hours for first scenarioBengaluru 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.

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.

  1. 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.
  2. Page the on-call for the application under test. Don't assume the system bounced back on its own; circuit breakers stay tripped.
  3. 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.LoadTestService can be reversed by removing the delegation.
  4. 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

FAQ

How much does Azure Load Testing actually cost for a real workload?
I track this every month. The first 50 virtual-user-hours are free. Above that you pay USD 0.10 per VUH. A serious test - 500 concurrent users for 20 minutes - eats about 167 VUH or USD 16.70 (INR 1,395). For monthly nightly tests on a mid-sized app I budget USD 60-90 (INR 5,000-7,500). My Chennai client last quarter: USD 73.
Can I run Azure Load Testing against an app inside a private VNet?
Yes, but you have to inject the engines into the VNet using the load-testing VNet integration feature. It needs a subnet with at least /26 free addresses and a delegation to Microsoft.LoadTestService. Total setup time the first time I did it: 38 minutes including network team back-and-forth.
Why are my numbers different from JMeter on my laptop?
Because your laptop is not Azure. The engine pool runs on B-series or D-series VMs with cleaner network paths than a residential Bengaluru fibre line. I once had a developer insist his laptop tests were authoritative. Production fell over within 6 hours of his sign-off. Trust the cloud-side numbers.
Does Azure Load Testing work with gRPC and websockets?
JMeter scripts cover both. URL-based tests do not. If you need gRPC, upload a JMX with the gRPC sampler plugin. For websockets the websocket-samplers-by-Peter-Doornbosch JMeter plugin is what I use - free, BSD-licenced, dropped into the JMX with no Azure-side config.
Where do I see the raw metrics, not just the dashboard?
Use 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

Related guides worth a look while you sort this one out: