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.