Skip to content

Commit 9a75a22

Browse files
authored
Merge pull request #295258 from ninallam/ninallam-multicert
Add article for using multiple certificates
2 parents 9bbd974 + e505b6c commit 9a75a22

File tree

3 files changed

+112
-6
lines changed

3 files changed

+112
-6
lines changed

articles/load-testing/how-to-test-secured-endpoints.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,3 +231,5 @@ When you run your load test, Azure Load Testing retrieves the client certificate
231231
## Related content
232232

233233
* Learn more about [how to parameterize a load test](./how-to-parameterize-load-tests.md).
234+
235+
* Learn more about [using multiple certificates in a load test](./how-to-use-multiple-certificates.md).
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
title: Use Multiple Certificates in Azure Load Testing
3+
titleSuffix: Azure Load Testing
4+
description: Learn how to configure and use multiple certificates securely in Azure Load Testing with a JKS file and Key Vault integration.
5+
services: load-testing
6+
ms.service: azure-load-testing
7+
author: saloniagrawal1997
8+
ms.author: salagrawal
9+
ms.date: 01/24/2025
10+
ms.topic: how-to
11+
---
12+
13+
14+
# Using multiple certificates in Azure Load Testing
15+
16+
Azure Load Testing supports the use of multiple certificates for secure communication during load testing scenarios. This article explains how to consolidate multiple certificates into a Java KeyStore (JKS) file, securely store the keystore password in Azure Key Vault (AKV), and configure Azure Load Testing to use the JKS file.
17+
18+
## Prerequisites
19+
Before you begin, ensure the following:
20+
- You have an [Azure Key Vault](https://jmeter-plugins.org/wiki/PluginsManager/) instance set up to store secrets.
21+
- You have the [Managed Identity (MI)](./how-to-use-a-managed-identity.md) of your Azure Load Testing resource configured.
22+
- You have created a [Java KeyStore (JKS)](https://docs.oracle.com/javase/8/docs/technotes/tools/unix/keytool.html) file containing all required certificates.
23+
- You have stored the JKS password as a secret in Azure Key Vault.
24+
25+
## Steps to configure multiple certificates
26+
27+
### Step 1: Create and secure the JKS file
28+
1. Use the **keytool utility** to create a JKS file and import all necessary certificates.
29+
```Terminal
30+
keytool -importcert -file <certificate-file> -keystore <keystore-name>.jks -alias <alias-name>
31+
```
32+
1. Store the JKS file's password as a secret in Azure Key Vault:
33+
- Open the Azure portal and navigate to your Key Vault.
34+
- Select **Objects > Secrets > Generate/Import**.
35+
- Enter a name and the password for the JKS file, then click **Create**.
36+
37+
### Step 2: Assign access to the Azure Load Testing managed identity
38+
1. In the Azure portal, go to your Azure Key Vault resource and select **Access Policies** from the left pane, then click **+ Create**.
39+
1. On the Permissions tab:
40+
- Under **Secret permissions**, select **Get**.
41+
- Click **Next**.
42+
1. On the **Principal** tab:
43+
- Search for and select the managed identity for the load testing resource.
44+
- Click **Next**.
45+
- If you're using a system-assigned managed identity, the managed identity name matches that of your Azure Load Testing resource.
46+
1. Click **Next** again to complete the access policy configuration.
47+
48+
When your test runs, the managed identity associated with your load testing resource can now read the secret for your load test from your Key Vault.
49+
Now that you've added a secret in Azure Key Vault and configured a secret for your load test, move to use secrets in Apache JMeter.
50+
51+
### Step 3: Use keystore configuration and JSR223 PreProcessor
52+
**Keystore configuration**
53+
54+
1. In your JMeter script, add the **Keystore Configuration** element to manage SSL certificates.
55+
- Go to **Test Plan > Add > Config Element > Keystore Configuration**.
56+
- Set the Alias field to match the certificate alias in your JKS file.
57+
58+
**JSR223 PreProcessor for dynamic SSL configuration**
59+
60+
1. Add a **JSR223 PreProcessor** to dynamically configure the SSL properties at runtime.
61+
- Go to **Thread Group > Add > PreProcessors > JSR223 PreProcessor**.
62+
- Set the language to Java.
63+
- Add the following script:
64+
```Terminal
65+
System.setProperty("javax.net.ssl.keyStoreType", "PKCS12");
66+
System.setProperty("javax.net.ssl.keyStore", "<path-to-your-keystore>");
67+
System.setProperty("javax.net.ssl.keyStorePassword", "<keystore-password>");
68+
```
69+
1. Replace `path-to-your-keystore` and `keystore-password` with your actual keystore file path and password.
70+
71+
### Step 4: Add a CSV data set config to iterate over certificates
72+
1. In your JMeter script, add a **CSV Data Set Config** element to iterate over the certificates in your JKS file.
73+
- Go to **Test Plan > Add > Config Element > CSV Data Set Config**.
74+
- Configure the following fields:
75+
- Filename: Path to the CSV file containing certificate aliases.
76+
- Variable Names: Name of the variable (e.g., certificateAlias).
77+
1. Create a CSV file with a list of certificate aliases from your JKS file. Each alias should be on a new line.
78+
1. Use the variable (e.g., ${certificateAlias}) in the Keystore Configuration or scripts to dynamically reference the current certificate alias during the test execution.
79+
80+
### Step 5: Upload test files
81+
1. In the Azure portal, navigate to your Azure Load Testing resource and start a new test creation workflow.
82+
1. Upload the following files:
83+
- The JKS file.
84+
- Your JMeter test script.
85+
- The CSV file with certificate aliases.
86+
87+
### Step 6: Configure parameters
88+
1. Go to the **Parameters** tab in the test creation workflow.
89+
1. Add a secret for the JKS password:
90+
- Name: The name of the secret in Azure Key Vault.
91+
- Value: The Key Vault URL (e.g., https://`key-vault-name`.vault.azure.net/secrets/`secret-name`).
92+
1. Configure the **Key Vault reference identity**, by specifying the Managed Identity of the Azure Load Testing resource that will access the Key Vault secret.
93+
94+
Review all configurations to ensure correctness. Click **Create Test** to finalize and run the test.
95+
96+
## Related content
97+
98+
* [Use a Managed Identity in Azure Load Testing](./how-to-use-a-managed-identity.md)
99+
100+
* [Test secure endpoints in Azure Load Testing](./how-to-test-secured-endpoints.md)

articles/load-testing/toc.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,14 @@ items:
5757
href: how-to-define-test-criteria.md
5858
- name: Parameterize load tests
5959
href: how-to-parameterize-load-tests.md
60-
- name: Test App Service web apps
61-
href: how-to-create-load-test-app-service.md
62-
- name: Test Azure Functions
63-
href: how-to-create-load-test-function-app.md
64-
- name: Optimize Azure Functions
65-
href: how-to-optimize-azure-functions.md
6660
- name: Test private endpoints
6761
displayName: virtual network, vnet, hybrid, on-premises, onprem, private link, subnet
6862
href: how-to-test-private-endpoint.md
6963
- name: Test secure endpoints
7064
displayName: secured, certificate, client certificate, password, oauth, security, secure endpoint
7165
href: how-to-test-secured-endpoints.md
66+
- name: Use multiple certificates in tests
67+
href: how-to-use-multiple-certificates.md
7268
- name: Run tests in debug mode
7369
href: how-to-run-tests-in-debug-mode.md
7470
- name: Schedule load tests
@@ -113,6 +109,14 @@ items:
113109
href: monitor-load-testing.md
114110
- name: Enable notifications
115111
href: how-to-create-notification-rules.md
112+
- name: Test Azure services
113+
items:
114+
- name: Test App Service web apps
115+
href: how-to-create-load-test-app-service.md
116+
- name: Test Azure Functions
117+
href: how-to-create-load-test-function-app.md
118+
- name: Optimize Azure Functions
119+
href: how-to-optimize-azure-functions.md
116120

117121
- name: Samples
118122
items:

0 commit comments

Comments
 (0)