How to pass cookies to azure load test

Jalal Feghhi 41 Reputation points
2025-04-18T15:14:29.8033333+00:00

We are setting up load testing in Azure. We use the request method to create the test plan, not jmeter. in the Request, we can pass header parameters and receive in the backend. However, when we pass the cookie in the request in the header with key name "cookie", it does NOT pass to the backend, it is always empty.

Azure Managed Applications
Azure Managed Applications
An Azure service that enables managed service providers, independent software vendors, and enterprise IT teams to deliver turnkey solutions through the Azure Marketplace or service catalog.
168 questions
0 comments No comments
{count} votes

Accepted answer
  1. Vinodh247 32,691 Reputation points MVP
    2025-04-18T16:34:47.68+00:00

    Hi ,

    Thanks for reaching out to Microsoft Q&A.

    When using Azure Load Testing and sending HTTP requests directly (not through JMeter), passing cookies via the "cookie" header in the request may not work as expected due to how Azure Load Testing manages request headers internally.

    Root Cause:

    Azure Load Testing might sanitize or omit certain headers (like Cookie) for security reasons or due to its internal HTTP client behavior. Some HTTP clients ignore manual cookie headers and expect cookie management to go through a cookie jar or cookie container.


    Workarounds

    Option 1: Use headers but with a custom header

    If your backend does not strictly require the standard Cookie header and you control the backend, you can pass cookies as a custom header like:

    "headers": { "x-cookie-data": "sessionid=abc123; token=xyz456" }

    Then, read x-cookie-data in the backend and process it as needed.

    Option 2: Switch to JMeter for cookie handling

    If you must use the Cookie header and cannot modify backend expectations, consider:

    • Switching to JMeter-based tests (which Azure Load Testing supports).
    • JMeter handles cookies natively via HTTP Cookie Manager.

    Since you are using requestbased load tests, and the native cookie header does not pass through, either:

    1. Pass cookies in a custom header and parse them server-side.
    2. Use JMeter for advanced cookie/session simulation.

    Please feel free to click the 'Upvote' (Thumbs-up) button and 'Accept as Answer'. This helps the community by allowing others with similar queries to easily find the solution.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.