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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
bytesizetrainer
New Member

HttpOperationException: Operation returned an invalid status code 'BadRequest'

I have created a .NET Core MVC App, but not able to get it running. It returns the subject error.

 

Microsoft.PowerBI.Api.EmbedTokenOperations.GenerateTokenWithHttpMessagesAsync(GenerateTokenRequestV2 requestParameters, Dictionary<string, List<string>> customHeaders, CancellationToken cancellationToken)

 

In the Azure Logs, I am able to trace the connection request to the Application have happened successfully, but the Token Generation does not happen. What could I be missing?

 

After viewing few blogs, I have added identity details before token generation to my Services -> Service.cs file

 

var effectiveIdentities = new List<EffectiveIdentity>();
            foreach (var dataset in datasets)
            {
                    effectiveIdentities.Add(new EffectiveIdentity(
                        username: "my_email_address",
                        datasets: new List<string> { dataset.Id.ToString() }
                    ));
            }

            // Bundle token requests for reports, datasets, and the workspace
            var tokenRequest = new GenerateTokenRequestV2(
                reports: reportTokenRequests,
                datasets: datasetTokenRequests,
                targetWorkspaces: workspaceRequests,
                identities: effectiveIdentities
            );

 

1 ACCEPTED SOLUTION
bytesizetrainer
New Member

Resolved after creating a New Workspace and Dataset. There were some issues with the Dataset due to which it returned a Bad Request

View solution in original post

2 REPLIES 2
bytesizetrainer
New Member

Resolved after creating a New Workspace and Dataset. There were some issues with the Dataset due to which it returned a Bad Request

bytesizetrainer
New Member

Tried troubleshooting using Fiddle, but did not throw up any error. While troubleshooting through browser, it shows Internal Server Error : Error Code 500

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.