Forum Discussion
Report Server Custom Authentication
Hello Everyone,
I am newbie in Power BI Report Server and tried to configure it for custom/form authentication as explained in this article
https://github.com/Microsoft/Reporting-Services/tree/master/CustomSecuritySample
I performed all steps as mentioned in article and when I browse ReportServer it successfully show me Login page. However whenever I click eiher "Register User" button OR "Login" button, I get following exception
An error occurred while attempting to add the account. Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
I notice that in article's Step 3 it is mentioned to add <CodeGroup> in RSSrvPolicy.config file for FullTrust permission. However the step description is very confusing to me
Add the following <CodeGroup> element after the existing code group in the security policy file that has a URL membership of $CodeGen as indicated below and then add an entry as follows to RSSrvPolicy.config. Make sure to change the below path according to your ReportServer installation directory: <CodeGroup class="UnionCodeGroup" version="1" Name="SecurityExtensionCodeGroup" Description="Code group for the sample security extension" PermissionSetName="FullTrust"> <IMembershipCondition class="UrlMembershipCondition" version="1" Url="C:\Program Files\Microsoft Power BI Report Server\PBIRS\ReportServer\bin\Microsoft.Samples.ReportingServices.CustomSecurity.dll"/> </CodeGroup>
I am not sure I have to add this CodeGroup as New code group below of existing Member Url="$CodeGen$/*" codegroup OR I will have to replace existing $CodeGen Member URL code group with this one. So I tried both. When I add this article CodeGroup as New below of existing then ReportServer browse successful and show login page, but Permission exception occur as shown above.

When I replace existing $CodeGen Member URL code group with this article code group then ReportServer does not browse and give HTTP 500 error.
So please expert guidance on this. Thanks
Thank you v-qiuyu-msft for comments. It seems I had wrong URL in CodeGroup membership. When I changed URL from
C:\Program Files\Microsoft Power BI Report Server\PBIRS\PowerBI\Microsoft.Samples.ReportingServices.CustomSecurity.dll
to C:\Program Files\Microsoft Power BI Report Server\PBIRS\ReportServer\bin\Microsoft.Samples.ReportingServices.CustomSecurity.dll, it seems the permission problem has resolved and I can register new user.
However when login goes successfull and navigate to ReportServer Web Portal URL, it shows HTTP 500 Internal Server ERROR. Is there any way to investigate and find-out root cause of it?
Thanks once again,
M. Irfan
Thanks pbx This link help me to find out the exact problem. So for rest of the community here is the reason of HTTP 500 error
When we added "machineKey" in <RSPATH>\ReportServer\web.config path, everytime when pbix service restarted it remove this key. The step mentined here need to be updated v-qiuyu-msft. Best solution is to add machinekey in "machine.config" file inside <system.web> and then restart machine
32-bit
%windir%\Microsoft.NET\Framework\[version]\config\machine.config
64-bit
%windir%\Microsoft.NET\Framework64\[version]\config\machine.config
Note: This entry may create conflicts/problem for other application running on same machine so be careful.
Hope this will help. Thank you.
18 Replies
- danielnordNew Member
For others trying to find the solution.
I had some problemswith 500 error too. I found out that there are a couple of steps you need to do after you have set the plugin. See my comment in this issue (danielnord): https://github.com/Microsoft/Reporting-Services/issues/49
- sowmyaKrishnaFrequent Visitor
Hi danielnord
I followed all steps but still I am getting below error. Can you please give me the solution .
018-12-14 15:03:14.8087|INFO|1|CONFIG : rsConfigFilePath = [C:\Program Files\Microsoft Power BI Report Server\PBIRS\ReportServer\rsreportserver.config] (env)
2018-12-14 15:03:17.1056|INFO|1|CONFIG : AccessControlAllowOrigin = [] (env)
2018-12-14 15:03:17.1056|INFO|1|CONFIG : AccessControlAllowHeaders = [] (env)
2018-12-14 15:03:17.1056|INFO|1|CONFIG : AccessControlAllowMethods = [GET, PUT, POST, PATCH, DELETE] (env)
2018-12-14 15:03:17.1056|INFO|1|CONFIG : AccessControlExposeHeaders = [] (env)
2018-12-14 15:03:17.1056|INFO|1|CONFIG : AccessControlMaxAge = [600] (env)
2018-12-14 15:03:17.1368|INFO|1|CONFIG : SecureConnectionLevel = [0] (env)
2018-12-14 15:03:19.2618|INFO|1|CONFIG : MaxActiveReqForOneUser = [20] (env)
2018-12-14 15:03:19.2618|INFO|1|CONFIG : MaxActiveReqForAnonymous = [200] (default)
2018-12-14 15:04:41.5054|INFO|5|Received request GET | RequestID = s_69cc7afc-3bd5-4042-be76-7f14cd3a3c0a
2018-12-14 15:04:41.5992|ERROR|5| 10.120.243.36: GET - 0:00:00.0833391
Exception: System.Web.HttpException (0x80004005): Unable to validate data.
at System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Boolean useValidationSymAlgo, Boolean useLegacyMode, IVType ivType, Boolean signData)
at System.Web.Security.FormsAuthentication.Decrypt(String encryptedTicket)
at Microsoft.BIServer.Owin.Common.Middleware.CustomAuthenticationMiddleware.CreateRequestContextFromCookie(IOwinContext context)
at Microsoft.BIServer.Owin.Common.Middleware.CustomAuthenticationMiddleware.CreatePortalIdentity(IOwinContext context)
at Microsoft.BIServer.Owin.Common.Middleware.CustomAuthenticationMiddleware.Invoke(IOwinContext context)
at Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.<Invoke>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---Thanks in Advance...
- pbxHelper V
Have you seen this? Take note of the very last comment.
https://github.com/Microsoft/Reporting-Services/issues/26
- malikirfan28Helper II
Thanks pbx This link help me to find out the exact problem. So for rest of the community here is the reason of HTTP 500 error
When we added "machineKey" in <RSPATH>\ReportServer\web.config path, everytime when pbix service restarted it remove this key. The step mentined here need to be updated v-qiuyu-msft. Best solution is to add machinekey in "machine.config" file inside <system.web> and then restart machine
32-bit
%windir%\Microsoft.NET\Framework\[version]\config\machine.config
64-bit
%windir%\Microsoft.NET\Framework64\[version]\config\machine.config
Note: This entry may create conflicts/problem for other application running on same machine so be careful.
Hope this will help. Thank you.
- AnonymousNot applicable
This worked for me.
Here are the details:
edited C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config
Add machinekey under system.web
I used Visual Studio to edit machine.config. Must start VS as admin.
Restart computer, restart rs service
- asheralikhanNew Member
I am Also getting the same issue...
- prazzy88Helper IWe are also facing same issue. Http 500 issue for custom authenticatiom after login page. Its not loading PBReports page
- malikirfan28Helper II
It seems a problem in Product which does not support this feature. :smileyfrustrated:
- v-qiuyu-msftCommunity Support
Hi malikirfan28,
I don't have much experience with develop section. Maybe mgmeyerriccardomutiJon-Heide from PG team have ideas?
Best Regards,
Qiuyun Yu- malikirfan28Helper II
Thank you v-qiuyu-msft for comments. It seems I had wrong URL in CodeGroup membership. When I changed URL from
C:\Program Files\Microsoft Power BI Report Server\PBIRS\PowerBI\Microsoft.Samples.ReportingServices.CustomSecurity.dll
to C:\Program Files\Microsoft Power BI Report Server\PBIRS\ReportServer\bin\Microsoft.Samples.ReportingServices.CustomSecurity.dll, it seems the permission problem has resolved and I can register new user.
However when login goes successfull and navigate to ReportServer Web Portal URL, it shows HTTP 500 Internal Server ERROR. Is there any way to investigate and find-out root cause of it?
Thanks once again,
M. Irfan
- malikirfan28Helper II
Dear v-qiuyu-msft, mgmeyer, riccardomuti, Jon-Heide
Please need your support to resolve this HTTP 500 Error after successful login on Power BI Report Server.
Thank you in advance