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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
gah113
Advocate I
Advocate I

ExportToFileInGroupAsync Fails with 400 Error (Bad Request)

I am building a .NET application to export Power BI reports hosted on an Azure capacity. The following code fails with a 400 Error (Bad Request) without any information:

 

var reportId = Guid.Parse(powerBiDashboardConfig.ReportId);
var datasetId = Guid.Parse(powerBiDashboardConfig.DatasetId);
var groupId = Guid.Parse(powerBiDashboardConfig.WorkspaceId);

// Set the export configuration properties:
var exportConfiguration = new PowerBIReportExportConfiguration
                          {
                               Settings = new ExportReportSettings
                                    {
                                        Locale = "en-us",
                                        IncludeHiddenPages = true                                        
                                    }
                                };
var exportReportRequest = new ExportReportRequest 
                          {
                               Format = FileFormat.PDF,
                               PowerBIReportConfiguration = exportConfiguration
                                };

// Send the export request:
var export = (await client.Reports.ExportToFileInGroupWithHttpMessagesAsync(groupId, reportId, exportReportRequest)).Body;

 

I have tried making this call manually and the export to PDF works as expected.

5 REPLIES 5
AmosHersch
Employee
Employee

Hi @gah113 ,

Is the report you're exporting a Power BI (PBIX) report or a Paginated (RDL) report?

Assuming it's a PBIX report I suggest yoy try to see the response message body (using fiddler for example) to see if it contains information regarding the error reason.

The message body reads: "Export report requires effective identity to be provided for the report's dataset"

I have tried to send the exportRequest with an effectiveIdentity and the same error message is returned.

Note that no effective identity is required when manually sending requests to reports/{reportId}/ExportTo via the REST API.

AFAIK this error indicates that your report's dataset has RLS applied, so you must provide an effective identity for that dataset in the export request.

Are you sure you've sent the request with effective identity correctly? Did you specify the dataset ID and RLS parameters?

You can try to export a report with a dataset that doesn't have RLS applied and see that you don't get this error.

When you call the API manually you're not using a Service Principal probably, and hence you don't require to provide an effective identity.

@AmosHersch thanks for your help! We resolved the issue by specifying a dataset ID in the datasets property of the effective identity we were passing.

Any reason this property is required for Export but not for other calls using effective identity (e.g. GenerateToken)?

I would expect this property to be required also in GenerateToken request, especially when the request is from a Service Principal. It might work without an effective identity (or without the property) for a master user.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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