Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Programatically connecting to power BI premium workspace using workspace url

Am trying to connect to a Power BI workspace by using the Workspace Connection URL.

Below is the code:

public static void ConnectToPowerBIAsUser()
{
string workspaceConnection = "powerbi://api.powerbi.com/v1.0/myorg/Superstoresales";
string userId = "test@nousinfo.com";
string password = "********";
string connectStringUser = $"DataSource={workspaceConnection};User ID={userId};Password={password};";
server.Connect(connectStringUser);
}

When i execute the code am getting the below error:

 

Microsoft.AnalysisServices.ConnectionException: 'The connection string is not valid.'

Inner Exception:

FormatException: Input string was not in a correct format.

 

sowmyas_0-1637651139106.png

 

12 REPLIES 12
ozhug
Advocate II
Advocate II

The key here is using the correct libraries

counter-intuitively do not use the Microsoft.AnalysisServices.Tabular library 
you need to use these libraries based on your code base.
For .NET Core we need to install those two libraries:

Microsoft.AnalysisServices.NetCore.retail.amd64

Microsoft.AnalysisServices.AdomdClient.NetCore.retail.amd64 

For .NET Framework those two libraries:

Microsoft.AnalysisServices.retail.amd64

Microsoft.AnalysisServices.AdomdClient.retail.amd64

TedPattison
Employee
Employee

As far as I can tell, the connection string looks fine. Can you confirm that this workspace is associated with a dedicated capacity?

Can you confirm your user ID is for a user with a Power BI Premium per User license. 


Did you copy the URL from workspace setting to ensure it matches

TedPattison_0-1637770292280.png

 

 

 

Anonymous
Not applicable

I tried with Username, Password and with Access token as well.

But am getting the same error in both cases.

 

 

Anonymous
Not applicable

Am having Premium Per User license. 

Please find the below screenshot for reference.

 

sowmyas_0-1637773616036.png

 

OK, one more thing to check. The Capacity administrator has the ability to set the XMLA endpoint to Off, Read Only or Read Write. If it is set to Off, the behavior you are seeing is expected. Are you able to check the XMLA Endpoint setting in Capacity Settings in the Power BI Admin portal as shown in this screenshot? If you don't have Capacity Admin permissions, you will need to find someonbody who does.  

 

TedPattison_0-1637776466971.png

 

Anonymous
Not applicable

HI @TedPattison 

I have eneabled XMLA Endpoint for ReadWrite and when i try to execute the above code am again getting the same error.

 

sowmyas_0-1637843334351.png

 

sowmyas_1-1637843465109.png

Could you please provide your inputs?

 

I have given you all the ideas I have about what the problem might be and how to troubleshoot it. I cannot think of anything else that might be wrong. I think at this point, you should contact Microsoft support who can captire more diagnositc info that might help to troubleshoot this.

Anonymous
Not applicable

Do capacity settings will be available for premium per user account?

When am checking admin portal capacity settings are not available for my premium per user account.

 

sowmyas_0-1637821865766.png

 

 

Anonymous
Not applicable

@TedPattison No workspace is not associated with dedicated capaticy. 

Premium per user is enabled for the  workspace.

Do we require premium capacity to perform data refresh?

 

The documentation doesn't mention anything explicitly but I wouldn't be surprised if there were API limitations too

 

Power BI Premium Per User - Power BI | Microsoft Docs

Anonymous
Not applicable

@lbendlin @TedPattison @v-shex-msft  Any inputs for the above query?

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.