http://www.sqlservercentral.com/blogs/pturley/2010/03/11/using-a-report-subscription-with-user-authentication/

Printed 2014/10/22 08:13AM

Using a Report Subscription with User Authentication

By pturley, 2010/03/11

This question comes up quite often. A report requires a user to be authenticated using their own network user name and password. Perhaps the data source performs row-level filtering for the user or the UserID global user object is used in a query or filter expression to return user-specific data. Whatever the case may be, how can you send scheduled subscriptions and filter the report for that user? This can be a challenge when scheduling a subscription for the report because a subscription requires that credentials be stored in the data source. This is not so much a limitation of Reporting Services as it is a logistical challenge. Why? ?because a subscription is designed to run unattended. The data source credentials must be stored so when the subscription fires in the middle of the night, the report and database query can run without the user logging in and sitting in front of their computer.

There are at least two possible solutions to this quandary . The first is to pass the UserID as a parameter and then filter the data in the query. The data source will still have to use a stored application credential but if user-specific filtering is the goal, this technique should meet the requirement. You can store each user?s UserID, along with any other report parameters and report execution settings (like the rendering format, etc.) in a table and then broadcast the report out to several users with a data-driven subscription.

The other approach is to use a scheduled subscription to email a link to the report, which will then run on-demand when the user clicks the emailed link. To do this:

When the user receives the subscription email, they will just see a link, which as actually a report drill-through action that they will use to open the second report. Since that report doesn't use stored credentials, it will use their own credentials to authenticate.



Weblog by Paul Turley and SQL Server BI Blog.
Copyright © 2002-2014 Simple Talk Publishing. All Rights Reserved. Privacy Policy. Terms of Use. Report Abuse.