Parameterize linked services in Azure Data Factory

APPLIES TO: yesAzure Data Factory yesAzure Synapse Analytics (Preview)

You can now parameterize a linked service and pass dynamic values at run time. For example, if you want to connect to different databases on the same logical SQL server, you can now parameterize the database name in the linked service definition. This prevents you from having to create a linked service for each database on the logical SQL server. You can parameterize other properties in the linked service definition as well - for example, User name.

You can use the Data Factory UI in the Azure portal or a programming interface to parameterize linked services.

Tip

We recommend not to parameterize passwords or secrets. Store all connection strings in Azure Key Vault instead, and parameterize the Secret Name.

For a seven-minute introduction and demonstration of this feature, watch the following video:

Supported data stores

At this time, linked service parameterization is supported in the Data Factory UI for the following data stores. For all other data stores, you can parameterize the linked service by selecting the Code icon on the Connections tab and using the JSON editor.

  • Amazon Redshift
  • Azure Cosmos DB (SQL API)
  • Azure Database for MySQL
  • Azure SQL Database
  • Azure Synapse Analytics (formerly SQL DW)
  • MySQL
  • Oracle
  • SQL Server

Data Factory UI

Add dynamic content to the Linked Service definition

Create a new parameter

JSON

{
	"name": "AzureSqlDatabase",
	"properties": {
		"type": "AzureSqlDatabase",
		"typeProperties": {
			"connectionString": "Server=tcp:myserver.database.windows.net,1433;Database=@{linkedService().DBName};User ID=user;Password=fake;Trusted_Connection=False;Encrypt=True;Connection Timeout=30"
		},
		"connectVia": null,
		"parameters": {
			"DBName": {
				"type": "String"
			}
		}
	}
}