An Azure service for ingesting, preparing, and transforming data at scale.
Hello @XiangChenxchen1-7804,
Thanks for the question and using MS Q&A platform.
If you use Azure Key vault mode after the Account Selection method settings, then you won't be able to parameterize your database name as you will have to provide the complete connection string in the AKV. You cannot pass the parameters values to AKV to validate the connection string.
Hence you will have to take second approach to go with Connection String mode after Account selection method settings. Then you will be able to save your Account key in Key vault and also you can parameterize the accountEndpoint in the URI section as well as you can parameterize the database name and pass them at runtime using pipeline parameters as needed.
Please see below for more info:
Here is a sample JSON payload of my test DBName parameterized linked service:
{
"name": "CosmosDb1SQLApiParameterizedDB",
"properties": {
"parameters": {
"DBName": {
"type": "string",
"defaultValue": "DefaultDBName"
},
"accountEndpoint": {
"type": "string",
"defaultValue": "DefaultEnpointName"
}
},
"annotations": [],
"type": "CosmosDb",
"typeProperties": {
"connectionString": "AccountEndpoint=https://@{linkedService().accountEndpoint}.documents.azure.com:443/;Database=@{linkedService().DBName}",
"accountKey": {
"type": "AzureKeyVaultSecret",
"store": {
"referenceName": "xxxxxxxSharedAKVLS",
"type": "LinkedServiceReference"
},
"secretName": "xxxxxxxCosmosDbSQLAPIConnStringWithDBParam",
"secretVersion": "56xxxxxxxxxxxxxxxxxxxxxxxxx6fe42"
}
}
},
"type": "Microsoft.DataFactory/factories/linkedservices"
}
Hope this will help. Please let us know if any further queries.
------------------------------
- Please don't forget to click on
or upvote
button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how