Web activity - is there a way not to expose this API-key in a pipeline?

braxx 456 Reputation points
2021-04-07T21:39:42.547+00:00

Hi Folks,

I have a pipeline which first takes token from a rest call (web activity) and then use this token to get data from rest API (copy activity).
To get a token I have to provide an API-key. Is there a way not to expose this API-key in a pipeline? Or maybe build this pipeline another, more secured way? Exposing it for other data factory users gives them oportunity to catch the token and later access data.

85481-captureaa.png

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,623 questions
{count} votes

Accepted answer
  1. MartinJaffer-MSFT 26,236 Reputation points
    2021-04-08T18:29:49.777+00:00

    Hello @braxx and welcome to Microsoft Q&A.

    Yes there is a more secure way to work with your key/password/confidential header.

    There is a parameter type called SecureString. Instead of placing the value directly in the Copy Activity header, place it in a parameter of type SecureString. Then in the Copy Activity header, refer to it. There is a complication, but first to show you how its done.

    85922-image.png
    85905-image.png
    @pipeline().parameters.secureHeader

    The complication is when using Git Mode you may see an error like below, telling you SecureString cannot have a default value.
    85914-image.png
    The solution is to leave the value in the pipeline blank, but instead give the value when you make a trigger. The trigger can store and hide the key. The trigger then gives the key to the pipeline parameter, which gives it to the web activity header.

    85931-image.png

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. braxx 456 Reputation points
    2021-04-22T10:43:04.293+00:00

    Hi Martin,

    Apologise for late replay.
    That's very interesting approach. I didn't know about secure string parameters. That's basically answer my question. I marked it as answer although I finally solved it a bit different way.

    What I did is to place the API-key in Key-Vault and created another web activity with MSI authentication to a key-vault to get this value.

    Thanks a lot :)

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.