How to set dynamically the database connection string in a tabular model

Ralf Mark 1 Reputation point
2021-01-06T12:57:36.557+00:00

I am using configurations for deploying the same tabular model to different clients (same model, same db structure, only difference is the db connection string). Unfortunately the connection string is not part of the configuration properties. Is there any way to set it dynamically? We use Azure Analysis Services. Thanks for any help/hints.

Azure Analysis Services
Azure Analysis Services
An Azure service that provides an enterprise-grade analytics engine.
456 questions
SQL Server Analysis Services
SQL Server Analysis Services
A Microsoft online analytical data engine used in decision support and business analytics, providing the analytical data for business reports and client applications such as Power BI, Excel, Reporting Services reports, and other data visualization tools.
1,290 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Nandan Hegde 32,416 Reputation points MVP
    2021-01-07T03:48:40.523+00:00

    Hey @Ralf Mark ,
    You can use the TMSL script to update the connection details dynamically .

    In Azure Devops , we use Azure Analysis service TMSL task to execute it and below is the parameterization of the script :

    {  
    "createOrReplace": {  
    "object": {  
    "database": "$(Model Name)",  
    "dataSource": "AEDW"  
    },  
    "dataSource": {  
    "name": "AEDW",  
    "connectionString": "Persist Security Info=false;User ID=$(AEDW Username);Password=$(AEDW Password);Encrypt=true;TrustServerCertificate=false;Data Source=$(AEDW Server Name);Initial Catalog=AEDW",  
    "impersonationMode": "impersonateAccount",  
    "account": "dev",  
    "provider": "System.Data.SqlClient",  
    "annotations": [  
    {  
    "name": "ConnectionEditUISource",  
    "value": "AzureSqlDW"  
    }  
    ]  
    }  
    }  
    }  
    

    Note: You can get the script by right clicking on your connection details and view script .
    The above is just a sample one

    1 person found this answer helpful.

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.