1

I'm currently working with some key vault secrets, and I'm trying to see if it is any way that we can pass some of the secrets into parameters inside of Azure pipelines. Does anyone has any idea of how to do this?

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Hvaandres
  • 755
  • 2
  • 12
  • 39

1 Answers1

0

These are the steps to solve this issue:

  1. Add keyvault under the azure portal

  2. Inside of your pipeline, you should click in the following options Library > + Variable Group > Add a name > Choose the option called "Link secrets from an Azure Key vault as variables" > Choose azure subscription > Choose Key Vault name > Choose your secret.

  3. In the pipeline itself you will need to add the following code:

parameters:
- name: TokenDev
  displayName: Token
  type: string
  default: keyvault
  values:
    - keyvaultdev
    - kevaultprod
variables:
- name: privateToken
  value: ${{parameters.TokenDev}}

  1. To call the secret inside of the variable, you just need to do the following:
$(private) [whatever name you provide to the secret]

If you want to learn more about Parameters, I will recommend you to click in here.

Hvaandres
  • 755
  • 2
  • 12
  • 39