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
PKidd
Frequent Visitor

Power bi print endpoint stops each day - Operation returned an invalid status code 'Forbidden'

Hi all,

We get access to power bi printing endpoint in the morning and then it stops, it varies when it stops, it never fails when we run it from Visual Studio. 

The error is Operation returned an invalid status code 'Forbidden'.

 

Would really like to know if we are reaching a limit that we are not aware of.

 

Our customers have access to the reports on a continual basis, no problems.

We have ruled out our firewall rules.

We have a premium backed embedded service EM1 SKU.

We use a service principal account.

Fabric capacity metrics do not show any thresholds being exceeded ever.

The webapp runs in a secure network segment.

Embed Trial tokens is 0 but we have purchased an embedded SKU so don't see this is the issue

 

The code we use:

  public static MemoryStream ExportPowerBIReport(

      Guid WorkspaceId,

      Guid ReportId,

      string ExportName,

      FileFormat ExportFileFormat,

      string ExportFilter = "")

  {

            var exportRequest = new ExportReportRequest

            {

                Format = ExportFileFormat,

                PowerBIReportConfiguration = new PowerBIReportExportConfiguration

                {                  

                    DefaultBookmark = new PageBookmark {State = ExportFilter }

                },

            };

 

   Export export = pbiClient.Reports.ExportToFileInGroup(WorkspaceId, ReportId, requestParameters: exportRequest);

          

            string exportId = export.Id;

 

   do

   {

    System.Threading.Thread.Sleep(5000);

    export = pbiClient.Reports.GetExportToFileStatusInGroup(WorkspaceId, ReportId, exportId);  

   } while (export.Status != ExportState.Succeeded && export.Status != ExportState.Failed); 

 

   if (export.Status == ExportState.Succeeded)

   {

        var exportStream = pbiClient.Reports.GetFileOfExportToFileInGroup(WorkspaceId, ReportId, exportId);

        var memoryStream = new MemoryStream();

        exportStream.CopyTo(memoryStream);

        return memoryStream;

   }

    return null;

  }

 

Thanks for any help

Paul

1 REPLY 1
AmosHersch
Employee
Employee

Hi @PKidd ,

Can you specify which of the requests gets the 'Forbidden' response? Is it always the 'ExportToFileInGroup' request or the request to 'GetExportToFileStatusInGroup'/'GetFileOfExportToFileInGroup' ? Did you check to see if the response body has additional details which might indicate the reason for the error response? You might need to capture the response with a tool like fiddler or trace the exception. The SDK will not show it to you AFAIK.

 

If you have an example of a request ID (from the response header) I might be able to help with finding the reason.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

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