willy sepulveda
willy sepulveda

Reputation: 149

Data Factory Set variable with KeyVault Value

How can I set a variable with the value that I have stored in a KeyVault secret?

Upvotes: 6

Views: 6153

Answers (1)

Joseph  Xu
Joseph Xu

Reputation: 6083

Update:
Hi @willy sepulveda. We only can secure the input and output in Web Activity,like follows:
enter image description here Input and output data will be sensitive:
enter image description here


You can use Web activity to access the Key Valut value. Refer this documentation. I also created a test.

  1. Open the properties of your data factory and copy the Managed Identity Object ID value. Open the key vault access policies and add the managed identity permissions to Get and List secrets.
    enter image description here

  2. Then I created a secret named myKey and set the value helloworld.

Note: The name of the secret (myKey) will be used below at Step 5. enter image description here

  1. Declare a String type variable named myVar in ADF pipeline. enter image description here

  2. In Web1 activity, select Sceure output. enter image description here

  3. Web1 activity settings
    URL: https://<your-keyvalut-name>.vault.azure.net/secrets/<your-secret-name>?api-version=7.0.

You need replace keyvalut name and secret name.

Authentication: Select Managed Identity.
Resource: Enter https://vault.azure.net. enter image description here

  1. In Set variable1 activity, add dynamic content @activity('Web1').output.value. enter image description here

  2. Debug result: I can see that the variable successfully received the secret value. enter image description here

Upvotes: 4

Related Questions