The full answer
Yes. Linked services in Azure Data Factory and Synapse pipelines can take parameters, so one linked service can connect to different servers, databases or paths at run time instead of one linked service per connection.
Why it helps
- One linked service for many databases on the same server, or many storage accounts.
- One factory definition promoted across development, test and production, with values supplied per environment.
- Metadata-driven pipelines that loop over a list of sources.
How it works Values flow from the pipeline to the dataset to the linked service.
- Linked service: add a parameter, such as
DatabaseName, and use it in a connection property with@{linkedService().DatabaseName}. - Dataset: add its own parameter, such as
DbName, and pass it to the linked service'sDatabaseName. - Pipeline: pass a value (a pipeline parameter, or
@item()inside a ForEach loop) to the dataset parameter in the activity.
{
"name": "AzureSqlDb",
"properties": {
"type": "AzureSqlDatabase",
"parameters": { "DatabaseName": { "type": "String" } },
"typeProperties": {
"server": "myserver.database.windows.net",
"database": "@{linkedService().DatabaseName}",
"authenticationType": "SystemAssignedManagedIdentity"
}
}
}
Example
A pipeline has a parameter SourceDatabases with the value ["sales", "finance", "hr"]. A ForEach loop runs a Copy activity for each item, passing @item() to the dataset's DbName, which passes it to the linked service. One linked service and one dataset copy from all three databases.
Things to know
- The authoring UI offers parameters for many common connectors; for any connector you can add them in the linked service's JSON.
- Don't pass secrets as parameters: they appear in run history. Use managed identity, or reference secrets in Azure Key Vault, where the secret name itself can be parameterised.
- Use global parameters or deployment parameter files in CI/CD for values that change per environment.
Common mistakes
- Forgetting the dataset layer: a linked service parameter can't be set straight from the activity; it must be passed through the dataset.
- Testing the connection with no value: give the parameter a default, or supply a value when you press "Test connection", or the test fails even though the pipeline would work.
- Parameterising too much: if every property is a parameter, nobody can tell from the factory what a pipeline connects to. Parameterise what actually varies, such as the database name or the folder path, and keep the rest fixed.
Last updated 16 October 2026
Sources