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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Error Parsing WS metadata exchange failed

I have been following the training exercise in https://docs.microsoft.com/en-us/power-bi/learning-catalog/developer-online-course 

Module 4: Embedding content (Part 2/5) uses the Power BI Embed Tool https://app.powerbi.com/embedsetup 

 

When I debug the solution provided by the tool I encouter the following error in the browser:

Error Parsing WS metadata exchange failed

 

This is associated with a message in the console;

Exception thrown: 'System.AggregateException' in mscorlib.dll

 

Adding a breakpoint to the exceptions allows me to catch the exception:

System.AggregateException
HResult=0x80131500
Message=One or more errors occurred.
Source=mscorlib
StackTrace:
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task`1.get_Result()
at PowerBIEmbedded_AppOwnsData.Services.EmbedService.<DoAuthentication>d__24.MoveNext() in C:\Users\<user ID>\Desktop\Power BI\PowerBIDevIAD\MySolution\Sample\App Owns Data\PowerBIEmbedded_AppOwnsData\Services\EmbedService.cs:line 331

Inner Exception 1:
AdalException: Parsing WS metadata exchange failed

Inner Exception 2:
XmlException: 'JavaScript' is an unexpected token. The expected token is '"' or '''. Line 24, position 18.

 

The error is occuring during a call to AcquireTokenAsync in Services\EmbedService.cs as per below

 

        private async Task<AuthenticationResult> DoAuthentication()

        {

            AuthenticationResult authenticationResult = null;

            if (AuthenticationType.Equals("MasterUser"))

            {

                var authenticationContext = new AuthenticationContext(AuthorityUrl);

 

                // Authentication using master user credentials

                var credential = new UserPasswordCredential(Username, Password);

                authenticationResult = authenticationContext.AcquireTokenAsync(ResourceUrl, ApplicationId, credential).Result;

 

As far as I can see a string contining 'JavaScript' is not a being passed to AcquireTokenAsync so this is some sort of internal issue.

 

 

 

2 REPLIES 2
Anonymous
Not applicable

I don't think screen shots will help, here’s what I have managed to figure out about the error.

 

The exception is documented here, which tells us nothing useful about the error

https://docs.microsoft.com/en-us/dotnet/api/microsoft.identity.client.msalerror.accessingwsmetadatae...

 

However I did figure out that this is the same error that occurs if I call AcquireTokenByUsernamePassword(). I was then able to locate the following details about the error:

 

Accessing WS Metadata Exchange Failed.

What happens?

You tried to use AcquireTokenByUsernamePassword(IEnumerable<String>, String, SecureString) and the account is a federated account.

Mitigation

None. The WS metadata was not found or does not correspond to what was expected.

 

https://docs.microsoft.com/en-us/dotnet/api/microsoft.identity.client.msalerror?view=azure-dotnet 

 

So the issue is that I am using a federated account. Amusingly to fix the issue it suggests I do nothing, 🤔 not a terribly helpful suggestion, obviously to mitigate the error I need to use an alternative account.

 

I went back to the main page for the course (https://docs.microsoft.com/en-us/power-bi/learning-catalog/developer-online-course#self-study-kit) and down the bottom of the page (where I had not got up to yet) I find this note:

 

"You're responsible for having your own Power BI account. If you don't already have one, see Sign up for Power BI as an individual.

Your account must have a Power BI Pro license, or you can still accept a Power BI Pro Trial license—an offer that can only be accepted once. Also, your account must not have depleted the reserve of free embed tokens, available with the Power BI Pro license.

Also, you must be OK to have your password stored in cleartext in the lab solution. Storing sensitive information is never a recommended practice—it's done to simplify the lab. If you want to encrypt your password, you'll need to implement the logic yourself.

Consider creating a Power BI account for exclusive use in the labs. You can create a free account with a public domain like https://outlook.live.com, and then using it to sign in to Power BI and accept the Power BI Pro Trial license."

 

So I ditch my work account, sign up for a free account at outlook live and sign up to Power BI free trial, only to find out that actually you need a work account to get a trial version of power BI 😖. To which I don't have a solution and honestly I have wasted way too much time trying to get round all the issues rather than just learning Power BI.

 

To summarise there are far too many roadblocks to what is supposed to be a single day course. I would like to see MS take the following actions:

  1. Fix the exception handling to give meaning full messages of the error
  2. Fix the documentation of the exception 
  3. Fix the course documentation to provide details of the account requirements at the start of the course and instructions that work.
  4. Provide a means by which users who wish to learn about Power BI can easily obtain a trial license.

 

At the very least hopefully my post will help other facing the same or related issues.

v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please provide screenshots related to the error.

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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