I am trying to create a CI/CD pipeline in Azure DevOps for PowerBi models. I am facing issue with Tabular editor when trying to connect to Premium workspace using SP on powershell taks. SP is certificate based. Any idea how should I create connection string when using certificate? According to documentation (https://docs.microsoft.com/en-us/power-bi/enterprise/service-premium-service-principal#connection-strings-for-the-xmla-endpoint) XMLA connection string should look like as bellow in case using of using secret:
Data Source=powerbi://api.powerbi.com/v1.0/myorg/<workspace name>; Initial Catalog=<dataset name>;User ID=app:<appId>@<tenantId>;Password=<app_secret>
I've trayed something like this and it doesnt work:
Data Source=powerbi://api.powerbi.com/v1.0/myorg/<workspace name>; Initial Catalog=<dataset name>;User ID=app:<appId>@<tenantId>;Password=cert:thumbprint
CodePudding user response:
When using a certificate you'll have to fetch the AccessToken first, and then pass the AccessToken as the password in the conenction string, which should look like this:
constr = $"Data Source={server};Password={token};Catalog={database};";