Skip to content

Commit 8688aff

Browse files
authored
Merge pull request #294740 from Nagarjuna-Vipparthi/ALT-MI-support-docs
ALT MI support docs
2 parents 1b9e492 + 071af08 commit 8688aff

File tree

3 files changed

+88
-3
lines changed

3 files changed

+88
-3
lines changed

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

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ ms.custom: template-how-to
1212

1313
# Load test secured endpoints with Azure Load Testing
1414

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.
1616

1717
Azure Load Testing supports the following options for authenticated endpoints:
1818

1919
- [Authenticate with a shared secret or user credentials](#authenticate-with-a-shared-secret-or-credentials)
2020
- [Authenticate with client certificates](#authenticate-with-client-certificates)
21+
- [Authenticate with a managed identity](#authenticate-with-a-managed-identity)
2122

2223
## Prerequisites
2324

@@ -228,6 +229,90 @@ certificates:
228229

229230
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.
230231

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.
280+
281+
```yaml
282+
- name: 'Azure Load Testing'
283+
uses: azure/load-testing@v1
284+
with:
285+
loadtestConfigFile: 'SampleApp.yaml'
286+
loadtestResource: 'MyTest'
287+
resourceGroup: 'loadtests-rg'
288+
referenceIdentities:
289+
- kind: "Engine"
290+
type: "user-assigned"
291+
identity: /subscriptions/abcdef01-2345-6789-0abc-def012345678/resourceGroups/sample-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/sample-identity
292+
```
293+
294+
# [Azure Pipelines](#tab/pipelines)
295+
296+
To add a managed identity for authentication in your load test in Azure Pipelines, update the Azure Pipelines definition file.
297+
298+
The following code snippet gives an example of how to configure a managed identity for authentication in Azure Pipelines.
299+
300+
```yaml
301+
- task: AzureLoadTest@1
302+
inputs:
303+
azureSubscription: 'MyAzureLoadTestingRG'
304+
loadTestConfigFile: 'SampleApp.yaml'
305+
loadTestResource: 'MyTest'
306+
resourceGroup: 'loadtests-rg'
307+
referenceIdentities:
308+
- kind: "Engine"
309+
type: "user-assigned"
310+
identity: /subscriptions/abcdef01-2345-6789-0abc-def012345678/resourceGroups/sample-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/sample-identity
311+
```
312+
---
313+
> [!IMPORTANT]
314+
> [Load distribution across regions](./how-to-generate-load-from-multiple-regions.md) is not enabled when you use managed identities for authentication.
315+
231316
## Related content
232317

233318
* Learn more about [how to parameterize a load test](./how-to-parameterize-load-tests.md).

articles/load-testing/how-to-use-a-managed-identity.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ms.topic: how-to
1313

1414
# Use managed identities for Azure Load Testing
1515

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.
1717

1818
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).
1919

@@ -201,5 +201,5 @@ Similarly, if you want to [set failure criteria on server metrics](./how-to-defi
201201
## Related content
202202
203203
* [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)
205205
* [What are managed identities for Azure resources?](/azure/active-directory/managed-identities-azure-resources/overview)
239 KB
Loading

0 commit comments

Comments
 (0)