Reporting Services (SSRS) - Error deleting mobile reports (Error invoking authorization extension)

Views: 237
Reading Time: 4 minutes

Hello people,
Good evening.

In this post, I will demonstrate how to solve a very strange problem in SQL Server Reporting Services 2016, which occurs while trying to delete some mobile reports and receiving this error message:

Error invoking authorization extension.

As this message is not at all explanatory, I decided to try parsing Reporting Services log files (usually located at “C: \ Program Files \ Microsoft SQL Server \ MSRS13.SyourInstance \ Reporting Services \ LogFiles”) to try to identify any tips from the source of the problem, but found the following message in one of the files:

Microsoft.ReportingServices.Portal.WebHost! Library! Error invoking authorization extension. -> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.ReportingServices.Authorization.SdAndType.GetRightSecDesc (SecurityItemType crtItemType, Hashtable secDescHash, Byte [] & primSecDesc, Byte [] & secSecDesc)
at Microsoft.ReportingServices.Authorization.WindowsAuthorization.InnerCheckAccess (String userName, IntPtr userToken, SecurityItemType itemType, Byte [] secDesc, UInt32 & rightsMask, ReportSecDescType rptSecDescType)
at Microsoft.ReportingServices.Authorization.WindowsAuthorization. <String> c__DisplayClassa. <CheckAccess> b__9 ()
at Microsoft.ReportingServices.Diagnostics.RevertImpersonationContext. <String> c__DisplayClass1. <Run> b__0 (Object state)
at System.Security.SecurityContext.Run (SecurityContext securityContext, ContextCallback Callback, Object state)
at Microsoft.ReportingServices.Diagnostics.RevertImpersonationContext.Run (ContextBody callback)
at Microsoft.ReportingServices.Authorization.WindowsAuthorization.CheckAccess (String userName, IntPtr userToken, Byte [] secDesc, FolderOperation requiredOperation)
at Microsoft.ReportingServices.Library.Security. <String> c__DisplayClass1f. <CheckAccess> b__1c ()
at Microsoft.ReportingServices.Diagnostics.ExtensionBoundary.Invoke (Method m)

As you noticed, the error message was not very clear. I decided to try to open the report in the Microsoft SQL Server Mobile Report Publisher tool, and the error message below appeared:

sql-server-reporting-services-2016-error-invoking authorization-extension-5

I imagine this problem occurred because there were reports using a particular dataset, which was deleted without being removed from the report before (The tool should not allow deletion if there are dependencies).

Resolving the problem and deleting the files

As I could not get any solution using the graphical tools, I decided to try to solve it through the database, connecting in the instance where Reporting Services was installed and accessing the ReportServer database.

For those who have never used this database, the main 2 tables are:
Datasets: Table that holds relationships between datasets and reports.

sql-server-reporting-services-ssrs-datasets-table

Catalog: Table that holds reports and the entire structure and organization of Reporting Services objects. It is the main table of contents.

sql-server-reporting-services-ssrs-catalog-table

Since there were several reports with this problem, where I couldn't delete them, I moved them to a folder called “Trash” and ran the following queries:

As a result, the “Trash” folder and all objects inside it were successfully deleted from the database and no longer appear in the Reporting Services Web Portal.

Manual Solution: Editing the Report File

Another solution to this would be to download the report file and extract it to a folder (just like you do with a ZIP file). Opening this folder you will find the file sources.xml, which contains the datasets used by the report.

The file should have something like this:

Also edit the file metadata.xml, where this excerpt from the file is what interests us:

Now edit the file. definition.xml, which contains all the objects that make up the report, and looks for all objects where the input is the name of the deleted dataset. The snippet we're looking at are the descendants of the <Elements> tag, and have this structure:

Finally, inside the folder "date", delete the .json file whose title is the name of the deleted dataset. Now save everything back to the .RSMOBILE file you downloaded and edited and open it in Mobile Report Publisher.

Ready. Your report is opening again, without the dataset deleted. You can now post it again.

I hope you enjoyed the post and even more.