Configure customer-managed keys for your Azure Load Testing resource with Azure Key Vault

Azure Load Testing automatically encrypts all data stored in your load testing resource with keys that Microsoft provides (service-managed keys). Optionally, you can add a second layer of security by also providing your own (customer-managed) keys. Customer-managed keys offer greater flexibility for controlling access and using key-rotation policies.

The keys you provide are stored securely using Azure Key Vault. You can create a separate key for each Azure Load Testing resource you enable with customer-managed keys.

Azure Load Testing uses the customer-managed key to encrypt the following data in the load testing resource:

  • Test script and configuration files
  • Secrets
  • Environment variables

Note

Azure Load Testing does not encrypt metrics data for a test run with your customer-managed key, including the JMeter metrics sampler names that you specify in the JMeter script. Microsoft has access to this metrics data.

Prerequisites

  • An Azure account with an active subscription. If you don't have an Azure subscription, create a free account before you begin.

  • An existing user-assigned managed identity. For more information about creating a user-assigned managed identity, see Manage user-assigned managed identities.

Limitations

  • Customer-managed keys are only available for new Azure Load Testing resources. You should configure the key during resource creation.

  • Azure Load Testing can't automatically rotate the customer-managed key to use the latest version of the encryption key. You should update the key URI in the resource after the key is rotated in the Azure Key Vault.

  • Once customer-managed key encryption is enabled on a resource, it can't be disabled.

Configure your Azure Key Vault

You can use a new or existing key vault to store customer-managed keys. The Azure Load Testing resource and key vault may be in different regions or subscriptions in the same tenant.

You have to set the Soft Delete and Purge Protection properties on your Azure Key Vault instance to use customer-managed keys with Azure Load Testing. Soft delete is enabled by default when you create a new key vault and can't be disabled. You can enable purge protection at any time.

To learn how to create a key vault with the Azure portal, see Create a key vault using the Azure portal. When you create the key vault, select Enable purge protection, as shown in the following image.

Screenshot that shows how to enable purge protection on a new key vault.

To enable purge protection on an existing key vault, follow these steps:

  1. Navigate to your key vault in the Azure portal.
  2. Under Settings, choose Properties.
  3. In the Purge protection section, choose Enable purge protection.

Add a key

Next, add a key to the key vault. Azure Load Testing encryption supports RSA keys. For more information about supported key types, see About keys.

To learn how to add a key with the Azure portal, see Set and retrieve a key from Azure Key Vault using the Azure portal.

Add an access policy to your Azure Key Vault

The user-assigned managed identity that you use to configure customer-managed keys on Azure Load Testing resource must have appropriate permissions to access the key vault.

  1. From the Azure portal, go to the Azure Key Vault instance that you plan to use to host your encryption keys. Select Access Policies from the left menu:

    Screenshot that shows access policies option in Azure Key Vault.

  2. Select + Add Access Policy.

  3. Under the Key permissions drop-down menu, select Get, Unwrap Key, and Wrap Key permissions:

    Screenshot that shows Azure Key Vault permissions.

  4. Under Select principal, select None selected.

  5. Search for the user-assigned managed identity you created, and then select it from the list.

  6. Choose Select at the bottom.

  7. Select Add to add the new access policy.

  8. Select Save on the Key Vault instance to save all changes.

Configure customer-managed keys for a new Azure Load Testing resource

To configure customer-managed keys for a new Azure Load Testing resource, follow these steps:

  1. In the Azure portal, navigate to the Azure Load Testing page, and select the Create button to create a new resource.

  2. Follow the steps outlined in create an Azure Load Testing resource to fill out the fields on the Basics tab.

  3. Go to the Encryption tab. In the Encryption type field, select Customer-managed keys (CMK).

  4. In the Key URI field, paste the URI/key identifier of the Azure Key Vault key including the key version.

  5. For the User-assigned identity field, select an existing user-assigned managed identity.

  6. Select Review + create to validate and create the new resource.

Screenshot that shows how to enable customer managed key encryption while creating an Azure Load Testing resource.

Change the managed identity

You can change the managed identity for customer-managed keys for an existing Azure Load Testing resource at any time.

  1. Navigate to your Azure Load Testing resource.

  2. On the Settings page, select Encryption.

    The Encryption type shows the encryption type you selected at resource creation time.

  3. If the encryption type is Customer-managed keys, select the type of identity to use to authenticate to the key vault. The options include System-assigned (the default) or User-assigned.

    To learn more about each type of managed identity, see Managed identity types.

    • If you select System-assigned, the system-assigned managed identity needs to be enabled on the resource and granted access to the AKV before changing the identity for customer-managed keys.
    • If you select User-assigned, you must select an existing user-assigned identity that has permissions to access the key vault. To learn how to create a user-assigned identity, see Use managed identities for Azure Load Testing Preview.
  4. Save your changes.

Screenshot that shows how to change the managed identity for customer managed keys on an existing Azure Load Testing resource.

Note

The selected managed identity should have access granted on the Azure Key Vault.

Change the key

You can change the key that you're using for Azure Load Testing encryption at any time. To change the key with the Azure portal, follow these steps:

  1. Navigate to your Azure Load Testing resource.

  2. On the Settings page, select Encryption. The Encryption type shows the encryption selected for the resource while creation.

  3. If the selected encryption type is Customer-managed keys, you can edit the key URI field with the new key URI.

  4. Save your changes.

Key rotation

You can rotate a customer-managed key in Azure Key Vault according to your compliance policies. To rotate a key, in Azure Key Vault, update the key version or create a new key. You can then update the Azure Load Testing resource to encrypt data using the new key URI.

Frequently asked questions

Is there an additional charge to enable customer-managed keys?

No, there's no charge to enable this feature.

Are customer-managed keys supported for existing Azure Load Testing resources?

This feature is currently only available for new Azure Load Testing resources.

How can I tell if customer-managed keys are enabled on my Azure Load Testing account?

  1. In the Azure portal, go to your Azure Load Testing resource.
  2. Go to the Encryption item in the left navigation bar.
  3. You can verify the Encryption type on your resource.

How do I revoke an encryption key?

You can revoke a key by disabling the latest version of the key in Azure Key Vault. Alternatively, to revoke all keys from an Azure Key Vault instance, you can delete the access policy granted to the managed identity of the Azure Load Testing resource.

When you revoke the encryption key you may be able to run tests for about 10 minutes, after which the only available operation is resource deletion. It's recommended to rotate the key instead of revoking it to manage resource security and retain your data.

Next steps