Search code examples
azureazure-devopsazure-pipelinesazure-keyvault

How to add new secrets (from Azure Key Vault) to the variable group in Azure Devops


I have built up a pipeline with a powershell task to create new secrets in Azure Key Vault. The same key vault is linked with Azure DevOps variable group (pipelines / library / variable group).

I already added few keys manually, but I want it to be able to add new secrets,which I create in Azure Key vault during the pipeline deployment also to the variable group.

Do I have to make use of REST API? https://learn.microsoft.com/en-us/rest/api/azure/devops/distributedtask/variablegroups/add?view=azure-devops-rest-7.1

Or can I make use of Powershell or something else?


Solution

  • As a workaround .. You may use AzureKeyVault to receive all secrets. Then you may use them in your pipeline.

    - task: AzureKeyVault@1
      inputs:
        azureSubscription:  Azure subscription. 
        KeyVaultName:  Key vault. 
        SecretsFilter: '*'