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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Anonymous
Not applicable

Impersonation Throws a "Bad Request" at Me Now

Not long ago, I was able to generate a token for the report embed with the following parameters:

 

devenv_2017-11-01_14-32-21.png

 

This allowed me to use the user to filter the report based on the row-level security settings. For some reason, today this now throws a "Bad Request" endpoint error at me.

 

The odd thing is that the request goes through just fine if I omit the impersonation. It works just fine if I simplify the code to:

var generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view");

However, this obviously doesn't help me with my row-level security issue.

 

Is anyone aware of any recent endpoint changes for spoofing an identity? Am I missing some information on the EffectiveIdentity instance?

 

1 ACCEPTED SOLUTION
Eric_Zhang
Employee
Employee


@Anonymous wrote:

Not long ago, I was able to generate a token for the report embed with the following parameters:

 

devenv_2017-11-01_14-32-21.png

 

This allowed me to use the user to filter the report based on the row-level security settings. For some reason, today this now throws a "Bad Request" endpoint error at me.

 

The odd thing is that the request goes through just fine if I omit the impersonation. It works just fine if I simplify the code to:

var generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view");

However, this obviously doesn't help me with my row-level security issue.

 

Is anyone aware of any recent endpoint changes for spoofing an identity? Am I missing some information on the EffectiveIdentity instance?

 


@Anonymous

It actually works in my test. The reason for bad request might be RLS is not applied for that dataset, the datasetId is incorrect for the embedding report etc.

 

In your case, I'd suggest you test calling the API GenerateToken in Postman or add try..catch block in your code to get the specific error message from the bad request.

try
                {
                    generatetoken()
                }
catch (HttpOperationException ex)
               { 
                    //Bad Request
                    var content = ex.Response.Content;
                    Console.WriteLine(content); 
                }

View solution in original post

3 REPLIES 3
Eric_Zhang
Employee
Employee


@Anonymous wrote:

Not long ago, I was able to generate a token for the report embed with the following parameters:

 

devenv_2017-11-01_14-32-21.png

 

This allowed me to use the user to filter the report based on the row-level security settings. For some reason, today this now throws a "Bad Request" endpoint error at me.

 

The odd thing is that the request goes through just fine if I omit the impersonation. It works just fine if I simplify the code to:

var generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view");

However, this obviously doesn't help me with my row-level security issue.

 

Is anyone aware of any recent endpoint changes for spoofing an identity? Am I missing some information on the EffectiveIdentity instance?

 


@Anonymous

It actually works in my test. The reason for bad request might be RLS is not applied for that dataset, the datasetId is incorrect for the embedding report etc.

 

In your case, I'd suggest you test calling the API GenerateToken in Postman or add try..catch block in your code to get the specific error message from the bad request.

try
                {
                    generatetoken()
                }
catch (HttpOperationException ex)
               { 
                    //Bad Request
                    var content = ex.Response.Content;
                    Console.WriteLine(content); 
                }
Anonymous
Not applicable

Thanks, @Eric_Zhang. I'll doublecheck everything and see if I can get the specific error message, and report back with my findings.

Anonymous
Not applicable

Well, I'm not sure what was wrong before, but it's working now. I didn't actually change anything other than adding the try/catch block, but the request went through anyway. Either way, it's good advice, and I'll log those so I can figure out what's going wrong if it happens again.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Kudoed Authors