You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/load-testing/how-to-test-secured-endpoints.md
+86-1Lines changed: 86 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,12 +12,13 @@ ms.custom: template-how-to
12
12
13
13
# Load test secured endpoints with Azure Load Testing
14
14
15
-
In this article, you learn how to use Azure Load Testing with application endpoints that require authentication. Depending on your application implementation, you might use an access token, user credentials, or client certificates for authenticating requests.
15
+
In this article, you learn how to use Azure Load Testing with application endpoints that require authentication. Depending on your application implementation, you might use an access token, user credentials, managed identity or client certificates for authenticating requests.
16
16
17
17
Azure Load Testing supports the following options for authenticated endpoints:
18
18
19
19
-[Authenticate with a shared secret or user credentials](#authenticate-with-a-shared-secret-or-credentials)
20
20
-[Authenticate with client certificates](#authenticate-with-client-certificates)
21
+
-[Authenticate with a managed identity](#authenticate-with-a-managed-identity)
21
22
22
23
## Prerequisites
23
24
@@ -228,6 +229,90 @@ certificates:
228
229
229
230
When you run your load test, Azure Load Testing retrieves the client certificate from Azure Key Vault, and automatically injects it in each JMeter web request.
230
231
232
+
## Authenticate with a managed identity
233
+
234
+
In this scenario, the application endpoint requires that you [use a managed identity to authenticate](/entra/architecture/service-accounts-managed-identities). You can use both system-assigned and user-assigned managed identities.
235
+
236
+
The flow for authenticating using a managed identity is:
237
+
238
+
1. Assign the managed identity that the target endpoint identifies to the Azure Load Testing resource.
239
+
1. Select the managed identity in the load test configuration.
240
+
241
+
You need to set up your load tests script to [fetch access token using managed identity](/entra/identity/managed-identities-azure-resources/how-to-use-vm-token#get-a-token-using-http) and to use the token to authenticate the requests to the target endpoint. For example, you can get a token through an HTTP REST call to the Azure Instance Metadata Service (IMDS) endpoint and then pass the token to a request using the `Authorization` HTTP header.
242
+
243
+
### Assign the managed identity
244
+
245
+
Assign the managed identity that has the required access to the target endpoint to your Azure Load Testing resource. When you run the test, Azure Load Testing assigns this identity to the engine instances. This ensures that your requests to fetch access tokens using the managed identity are successful.
246
+
247
+
You can use either a system-assigned managed identity or a user-assigned managed identity,
248
+
249
+
* To use a system-assigned managed identity, first [assign a system-assigned managed identity](/azure/load-testing/how-to-use-a-managed-identity?tabs=azure-portal#assign-a-system-assigned-identity-to-a-load-testing-resource) to your Azure Load Testing resource. Once it is enabled, provide the required RBAC permissions for this identity on the target endpoint.
250
+
251
+
* To use a user-assigned managed identity, first [assign the user-assigned identity](/azure/load-testing/how-to-use-a-managed-identity?tabs=azure-portal#assign-a-user-assigned-identity-to-a-load-testing-resource) to your Azure Load Testing resource. If this identity does not have the required RBAC permissions on the target endpoint, provide the required permissions. If your test script uses multiple user-assigned multiple identities, assign the multiple identities to your resource and ensure that they have the required RBAC permissions.
252
+
253
+
### Select the managed identity in the load test configuration
254
+
255
+
Select the required managed identity when you create or edit a test in Azure Load Testing.
256
+
257
+
# [Azure portal](#tab/portal)
258
+
259
+
To select and configure a managed identity for authentication in the Azure portal:
260
+
261
+
1. Navigate to your load testing resource in the Azure portal, and then select **Tests** to view the list of load tests.
262
+
263
+
1. Select your test from the list, and then select **Edit** to edit the load test configuration.
264
+
265
+
:::image type="content" source="./media/how-to-test-secured-endpoints/edit-load-test.png" alt-text="Screenshot that shows how to edit a load test in the Azure portal." lightbox="./media/how-to-test-secured-endpoints/edit-load-test.png":::
266
+
267
+
1. On the **Test plan** tab, configure the **Managed identity for authentication scenarios**. Select 'System-assigned identity' or 'User-assigned identity' as required.
268
+
269
+
:::image type="content" source="media/how-to-test-secured-endpoints/load-test-managed-identity-selection.png" alt-text="Screenshot that shows how to select managed identity for authentication in a load test in the Azure portal." lightbox="media/how-to-test-secured-endpoints/load-test-managed-identity-selection.png":::
270
+
271
+
1. If you selected 'User-assigned identity', select the required identities from the **User-assigned identity** dropdown.
272
+
273
+
1. Select **Apply**, to save the load test configuration changes.
274
+
275
+
# [GitHub Actions](#tab/github)
276
+
277
+
To add a managed identity for authentication in your load test in GitHub Actions, update the GitHub Actions workflow YAML file.
278
+
279
+
The following code snippet gives an example of how to configure a managed identity for authentication in GitHub Actions.
> [Load distribution across regions](./how-to-generate-load-from-multiple-regions.md) is not enabled when you use managed identities for authentication.
315
+
231
316
## Related content
232
317
233
318
* Learn more about [how to parameterize a load test](./how-to-parameterize-load-tests.md).
Copy file name to clipboardExpand all lines: articles/load-testing/how-to-use-a-managed-identity.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ ms.topic: how-to
13
13
14
14
# Use managed identities for Azure Load Testing
15
15
16
-
This article shows how to create a managed identity for Azure Load Testing. You can use a managed identity to securely read secrets or certificates from Azure Key Vault in your load test.
16
+
This article shows how to create a managed identity for Azure Load Testing. You can use a managed identity to securely read secrets or certificates from Azure Key Vault in your load test. You can also use managed identities to simulate managed identity based authentication flows in your load test scripts.
17
17
18
18
A managed identity from Microsoft Entra ID allows your load testing resource to easily access Microsoft Entra protected Azure Key Vault. The identity is managed by the Azure platform and doesn't require you to manage or rotate any secrets. For more information about managed identities in Microsoft Entra ID, see [Managed identities for Azure resources](/azure/active-directory/managed-identities-azure-resources/overview).
19
19
@@ -201,5 +201,5 @@ Similarly, if you want to [set failure criteria on server metrics](./how-to-defi
201
201
## Related content
202
202
203
203
* [Use secrets or certificates in your load test](./how-to-parameterize-load-tests.md)
204
-
* [Configure customer-managed keys for encryption](how-to-configure-customer-managed-keys.md)
204
+
* [Load test authenticated endpoints](./how-to-test-secured-endpoints.md)
205
205
* [What are managed identities for Azure resources?](/azure/active-directory/managed-identities-azure-resources/overview)
0 commit comments