liprec / vsts-release-aas

Repository for my Analysis Service Azure pipelines tasks related to Azure Analysis Service or Power BI Premium
Other
27 stars 28 forks source link

Error connecting to tabular service. (Exception calling "Connect" with "1" argument(s): "Failed to resolve PBI workspace. Description: #99

Closed SeanMuggin closed 2 years ago

SeanMuggin commented 2 years ago

I have had an admin set up my xmla endpoint set up for read/write and all other necessary configuration described here https://github.com/TabularEditor/tabulareditor.github.io/blob/master/_posts/2020-06-02-PBI-SP-Access.md#enable-service-principal-api-access for setting up a Service Principal. Filled in all necessary information in the Power Platform service connection. I have not set up the SP or anything else in the actual Power Platform portal. I could reach out to an admin if that is necessary but I don't have access to that.

This is a TestDB with a skeleton model and no data source.

image image image
liprec commented 2 years ago

Please make sure that you also add the SP to the workspace ad Member or Admin. See for more info: https://docs.microsoft.com/en-us/power-bi/enterprise/service-premium-service-principal#workspace-access

SeanMuggin commented 2 years ago
image

Are you referring to the PowerBI workspace or the Power Platform environment? I have the SP included in the DevOpsSG security group which is included as an Admin in the PowerBI workspace

liprec commented 2 years ago

If that is the workspace that is 'behind' the XMLA endpoint that that part is correct. Can you connect to the XMLA endpoint with SSMS and the SP?

SeanMuggin commented 2 years ago

I have been using Tabular Editor v 2.16.5 to test my xmla connections and I can indeed make a successful connection and even a successful deployment using the same xmla endpoint. The difference with Tabular Editor GUI is that it uses a UI popup for credentials instead of the SP

liprec commented 2 years ago

I have no experience with Tabular Editor, but can you try to connect with username: app:<appId>@<tenantid> and as password the SP secret? And replace <appid> and <tenantid> with the correct guids.

SeanMuggin commented 2 years ago

Probably worth mentioning my first attempt at CI/CD was using the Tabular Editor workflow and I get the same error when trying to make a CLI deployment. I have tried to isolate my issue by using multiple different tabular models/ workspaces and creating a fresh tabular models and fresh DB but always get the same result. I go into detail of my deployment attempts with tabular editor in this github issue here : https://github.com/TabularEditor/TabularEditor/issues/972

SeanMuggin commented 2 years ago
image

Exact error I have been receiving when trying to use the SP

SeanMuggin commented 2 years ago

Is there an alternate CLI command or authorization I can try using User credentials instead of Service Principal to confirm it is the Service Principal that is causing the issue? I have already done successful deployments using the XMLA endpoint using the user credentials of the Admin account DevOps that you see in the Workspace Access screenshot above so I may have already proven that point.

At least Tabular Editor doesn't like when I try and replace User Id= and Password= with my user credentials instead of SP creds

image

Whereas when I connect with the connection string omitting the credentials and just pointing to the workspace it works fine

image
liprec commented 2 years ago

Can you try using the 'Username and Password' authentication option of TE to login? And to make sure that all the basics are correct: the XMLA endpoint is correct and have a Premium or PPU license assigned?

SeanMuggin commented 2 years ago
image

This works

image
liprec commented 2 years ago

Can you make sure that the secret doesn't contain any quotes (single or double)? PowerShell does have issues with those and needs escaping, so the uncomplicated way is to go with a secret without.

SeanMuggin commented 2 years ago

No quotes. The only symbols my secret contains are '.' and '~'

liprec commented 2 years ago

Is it possible to run the pipeline with system.debug set to true and share the debug.log file?

SeanMuggin commented 2 years ago

I'll look into that now. Thanks for your time. I really appreciate it

SeanMuggin commented 2 years ago

I can post the text directly if you would prefer not to download but it is lengthy

tasklog_9.log

SeanMuggin commented 2 years ago

The last line I see output in the logs from deploy-aas-db.ps1 is Write-Verbose "Loading database '$databaseName' from '$aasServer'" So I think it must be failing on line 171

$currentDatabase, $server = LoadTabularDatabaseFromServer -server $aasServer -database $databaseName -credential $credential

SeanMuggin commented 2 years ago

I got it to work by switching the login type to "Named user" which I guess can work temporarily but says it will be deprecated soon. I am fairly certain I have gone through every necessary step to set up the Service Principal correctly but there must be something unique with my deployment environment that is not allowing the Service Principal to connect to the workspace.

SeanMuggin commented 2 years ago

Reached out to admin who set up the Service Principal and confirmed they accidently assigned my user account to the Security Group instead of the Service Principal which is why it was working with "Named user" instead of the inherited Service Principal from the Service Connection.