Azure Key Vault without Azure Libraries in Playwright (Part 1)

Kam Marwaha
2 min readOct 25, 2023

--

This tutorial will be split into three parts. The first two parts will cover Azure Setup, the third part will cover integrating the Key Vault in a Playwright project.

If you have created a Key Vault, please click below go to the next tutorial in this series, which will cover ‘App Registration.’

Part 2 — App Registration

Part 3 — Integrating with Playwright

Gone are the days where you can use plain text credentials for your automation tests. Azure Key Vault (or well any Key Vault for that matter) is a more secure alternative to storing plain text passwords.

The benefits include:

  1. Enhanced Security: Azure Key Vault supports RBAC (role based access control) or Access Policies
  2. Centralised Management: Instead of scattering passwords across various applications or configuration files, you can centralise them in Key Vault.
  3. Versioning and Auditing: Azure Key Vault supports versioning for secrets, keys, and certificates. When a secret or key is updated or modified, a new version is created. This allows you to maintain a history of changes and retrieve specific versions if needed.

Prerequisites for this tutorial:

  1. Access to the Azure portal
  2. A valid subscription and resource group — our Key Vault will be stored in that resource group.

First we want to go to our Resource group and click ‘Create’. On the Marketplace screen, search for ‘Key Vault’ and click Create.

Create Key Vault screen

You’ll see a window similar to the one above. We then need to set the name of the Key Vault and choose an appropriate ‘Region’.

Click Next to see ‘Access Configuration’. For this tutorial we want to select ‘Vault access policy’ and click create.

You can then store your credentials in the ‘Secrets’ section of the Key Vault by clicking ‘Generate/Import’ and follow the on screen instructions for that.

Note: underscores are not allow for any names. So my solution is to replace the underscores with hyphens and obviously take note of this when using Key Vault.

Hope that helped. Please read the next tutorial, App Registrations.

--

--