Forum Discussion
C# XMLA TOM Connection Failing
- 9 months ago
v-sgandrathi GilbertQ I appreciate the back and forth you've provided. I have been unable to get the Tabular Object Model to work. However, I have found a way using the ADOMD connection to get the datasource names that includes the actual table or view named used in each Power BI report and this helps.
Again thank you for your time. I may revisit this as I'd like to figure out how to get TOM to work. I'm not sure if it's my .Net Framework, if it needs Core or something else.
Hi TCavins,
Thank you for providing the screenshot. Your Power BI Service API permissions are currently set as Delegated, which are for user sign-in authentication. Since you're using a service principal and app-only authentication, you need to set these permissions as Application instead. Keep the same scopes App.Read.All, Dataset.ReadWrite.All, Report.ReadWrite.All, SemanticModel.ReadWrite.All, and Workspace.ReadWrite.All, but add them under Application and grant admin consent in Azure AD.
Then, in the Power BI Admin Portal - Tenant Settings, confirm that service principals can use Power BI APIs and that the XMLA endpoint is enabled with Read/Write access. Also, make sure your workspace is in PPU or Premium capacity and that your service principal is set as an Admin for that workspace.
Once these changes are made, use token-based authentication instead of User ID and Password. Obtain the token with the Microsoft Authentication Library (MSAL), and connect using a string like:
DataSource=powerbi://api.powerbi.com/v1.0/myorg/<WorkspaceName>;Password=<access_token>;
You don't need to change myorg to your domain, as this format is required by Power BI. These steps should help resolve “invalid connection string” or “format exception” errors when connecting through TOM.
Thank you.
v-sgandrathi GilbertQ I appreciate the back and forth you've provided. I have been unable to get the Tabular Object Model to work. However, I have found a way using the ADOMD connection to get the datasource names that includes the actual table or view named used in each Power BI report and this helps.
Again thank you for your time. I may revisit this as I'd like to figure out how to get TOM to work. I'm not sure if it's my .Net Framework, if it needs Core or something else.