1
votes

I have create few keys and secrets in my Azure Key Vault. And my Single Page Application developed in reactjs needs some of these keys which are basically API urls. These keys are common for few other SPAs.

I have gone through one article here, but i have no idea how to bring it to the single page web app.

https://thorsten-hans.com/integrating-azure-keyvault-with-azure-container-services

Is there a way we can make these azure key vault keys/secrets to be available to Azure Devops build (we are using docker file and AKS) and then it can be consumed by the build of my front end app?

2

2 Answers

1
votes

you can add a key vault task in your pipeline to get the secrets:

https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-key-vault?view=azure-devops

then, you'll need to pass them as environment variables to your SPA:

How to use environment variables in React app hosted in Azure

1
votes

It's same as how you would consume keyvault in any other application on Azure Devops.

If you are starting with KeyVault, here is a great tutorial on setting up keyvault with Azure Devops using the Keyvault task

Which includes steps as

  • Configure a Variable Group to connect to an Azure Key Vault
  • Configure a Pipeline to make use of the new Variable Group