Is it possible to upload multiple 'Secret' to the 'Key Vault'? E.g.: Upload a csv, env file, etc?

Nuri Engin 31 Reputation points
2021-10-07T11:38:20.51+00:00

Hello,

We have recently discovered the features behind the Azure Key Vault service to use within Azure DevOps.
Thus, working on the Key Vault to benefit it as much as possible.

I was looking around the web to find out if there is any tutorial doc, exploration article, etc to find out any possible way to upload Secrets to the Key Vault. Unfortunatelly couldn't come across it.

We are going to link the Secrets to the Azure DevOps > Release > Library > Variable group, and we are having more than 200 variables to work on it for each application/project and in total almost for a thousand ones.

Looking for a way to upload secrets with their values with one single action/button or any other way to avoid time-consuming.
Is there any possible way to achieve this purpose?

Thank you.

Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
1,187 questions
0 comments No comments
{count} votes

Accepted answer
  1. kobulloc-MSFT 26,131 Reputation points Microsoft Employee
    2021-10-08T20:10:31.17+00:00

    Hello, @Nuri Engin !

    You may be tempted to look at multi-line secrets and use a JSON file but that would create a single point of access for all secrets. Instead, I would use a script using whatever you are most comfortable with:

    PowerShell using ConvertTo-SecureString and Set-AzKeyVaultSecret:

    $secretvalue = ConvertTo-SecureString "MySecretValue" -AsPlainText -Force  
    $secret = Set-AzKeyVaultSecret -VaultName "<your-unique-keyvault-name>" -Name "ExamplePassword" -SecretValue $secretvalue  
    

    .NET using SetSecretAsync():

    await client.SetSecretAsync(secretName, secretValue);  
    

    Node.js using setSecret:

    await client.setSecret(secretName, secretValue);  
    

    Python using set_secret:

    client.set_secret(secretName, secretValue)  
    

    Java using secretClient.setSecret:

    secretClient.setSecret(new KeyVaultSecret(secretName, secretValue));  
    
    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful