How To Use ‘Specify dynamic contents in JSON format’ in Azure Data Factory Linked Services

Make any Azure Data Factory Linked Service dynamic!

In a few different community circles I’ve been asked ‘how to handle dynamic Linked Service connections in Azure Data Factory if the UI doesn’t naturally support the addition of parameters’. Depending on the Linked Service the support for this varies.

Well, the answer, or should I say, Microsoft’s quick hack answer, is use the ‘Specify dynamic contents in JSON format’ option available for all Linked Services regardless of there type/popularity. This feature enables an empty text box where you can define anything about the Linked Service. It also removes all other attributes from the Linked Service connection panel, except Title and Description.

What this setting does is basically allow you to write you own JSON definition (in full) for the intended Linked Service. This then gives you the flexibility to parameterise anything in the key/value pair structure and means you don’t need to worry about Data Factory naturally supporting the Linked Service being dynamic via the usual developer canvas and expression builder. The down side that I’ve already alluded to, is that if you only want one value in the Linked Service to be dynamic you’ll have to provide the complete JSON definition for everything.

To be explicit about this behaviour if you haven’t seen it before…

If you want to inject parameters into a Linked Service for an Azure SQLDB, you get the full UI and expression builder support, as follows:

I blogged about doing this in more detail for an Azure SQLDB here if you want to look back.


However, in the equivalent panel for an Azure Key Vault Linked Service connection you get nothing, no expression builder support.


That is, unless you expand the Advanced section and tick Specify dynamic contents in JSON format. Then the UI panel changes to the following.

What we can then do is add the complete JSON definition for the Linked Service including any required parameters.

Let’s say, for example, we want the Key Vault URL to be dynamic, you could add the JSON like this:

Then, like other Data Factory components, the parameter value would bubble up wherever you try to use the dynamic content. In the case of the Key Vault Linked Service, even when you hit Test Connection.


Give it a try!

Dynamic values for all your Linked Services using custom JSON definitions via the ‘Specify dynamic contents in JSON format’ tick box  🙂

Hope this helps.

Many thanks for reading.

8 thoughts on “How To Use ‘Specify dynamic contents in JSON format’ in Azure Data Factory Linked Services

  1. An interesting discussion is value comment. I feel that you should write extra on this topic, it may not be a taboo topic however usually individuals are not sufficient to speak on such topics. To the next. Cheers

    Like

  2. you can further use dynamic JSON to hack KeyVault references into almost everywhere
    This also comes in very handy if you want to manage all environment-specific settings using a KeyVault and during the deployment you simply change the baseURL of the KeyVault linked service then

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.