Azure SQL database linked service for parameterising server name and db name

Rajendran, Prakash 1 Reputation point
2022-07-28T10:57:46.487+00:00

Hello,

I am using parameters in the Azure SQL database linked service for server and db name. Though the parameters used are not secured string type, connection string in ARM template for Azure sql db linked service gets into secure mode and thus @{linkedService().sql_server_name} and @{linkedService().sql_db_name} are not assigned. Due to that, I am not able to parameterize the value and also the parameters are not getting deployed to the connection string in higher environments during pipeline deployment. I have done the same for Azure storage and that works but sql db linked service not.

Please refer the screenshots. 225765-dev-env-linkedservice.png225766-armtemplate.png225774-acceptance-env-linkedservice.png

Azure SQL Database
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,623 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. MartinJaffer-MSFT 26,236 Reputation points
    2022-08-01T02:29:49.923+00:00

    Hello @Rajendran, Prakash ,
    Thanks for the question and using MS Q&A platform.

    As I understand, the problem is that during ARM template creation, your SQL connection string is being turned into secure string when you do not want it to. You do not want it as secure string, because you parameterized the linked service.

    So, we need to tell Data Factory to not do that to connection strings. Warning: below solution will apply this to ALL connection strings, not just the single one in question.

    In the Data Factory, go to the Management tab. Then under "Source Control" click "ARM template". Then click "Edit parameter configuration". This will bring you to where you can choose what gets parameterized and how.

    226564-image.png

    You are looking for "connectionString" under "Microsoft.DataFactory/factories/linkedServices": {

    226526-image.png

    we want to change it away from

    "connectionString": "|:-connectionString:secureString",  
    

    to

    "connectionString": "=",  
    

    Then try "Export ARM Template" and see if it works as expected. Check both this specific linked service, and some other one.

    Please do let me if you have any queries.

    Thanks
    Martin


    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
      • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    0 comments No comments

  2. Rajendran, Prakash 1 Reputation point
    2022-08-01T10:41:52.617+00:00

    Hi Martin,

    Indeed it made changes to the ARM template parameters by adding the connection properties. Just wondering why the default value is not getting assigned to sql connection string as just like blob storage. At the moment I am passing value as "Integrated Security=False;Encrypt=True;Connection Timeout=30;Data Source=@{linkedService().sql_server_name};Initial Catalog=@{linkedService().sql_db_name}" via release pipeline using ARM template deployment. How can I tell ADF to assign this value by default when it generates ARM template during publish? Or would it be a problem if I manually edit the ARMTemplateforFactory.json file to have default value for sql db linked service?

    226677-arm-template-parameters.png

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.