We have an SQL 2008 R2 server running reporting services and I would like to identify reports that use specific credentials to connect to a data source. In this situation, the reports connect to the data source using a custom data source with a specific user account that has the proper security on the SQL server to run the reports.
Plan plan was to query [ReportServer].[dbo].[Catalog] to get a list of reports. Then run it through the code below to identify the reports using credentials I'm interested in. All of this would be done in an SSIS package.
Using the ReportingService API, I can read the user name of the credentials in the connection strings of shared data sources. The code is listed below. However, in my case, I need to load the data source credentials from a custom data source specific to the report, not a shared data sources. The GetDataSourceContents method doesn't seem to support this. If I supply the report name & path instead of the shared data source, it generates an error.
Is there another way to approach this? We have hundreds of reports, so using the UI to look this information up would be impractical.
Thanks in advance.
NOTE: "web_service" is the web service reference to the report server (http://[servername]/ReportServer/ReportService2005.asmx?WSDL)
Dim rs As New web_service.ReportingService2005()
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim ds_def As web_service.DataSourceDefinition
ds_def = rs.GetDataSourceContents("/Data Sources/data_source_1")
With MyCredentialsOutputBuffer
.AddRow()
.UserName = ds_def.UserName
End With
You will need to pull down the rdl content and parse it:(
Embedded data source information is stored in the .rdl and not a shared data set item obtained via the api. Even then you can't retrieve data source passwords.
Related
I'm trying to store rendered pdf-reports from the Report Server back into a table of the origin database as a varbinary. My current approach would be to use URL-Access inside of an external python script to get the rendered reports and then save them into the corresponding table. The following URL works as expected in the browser:
http://localhost/reportserver?/ReportingServicesTest/Report_Test&rs:Format=PDF
However when I tried to access that URL inside of the external python script I received a 401 error.
So I then tried to use the requests_ntlm library to pass the username and password, but somehow it still doesn't work.
import requests
from requests_ntlm import HttpNtlmAuth
url = 'http://localhost/reportserver?/ReportingServicesTest/Report_Test&rs:Format=PDF'
session = requests.Session()
session.auth = HttpNtlmAuth('Domain\\Username','password')
response = session.get(url,stream=True)
open('C:/Path/Report_Test.pdf', 'wb').write(response.content)
Is my approach in principle correct or are there better ways to accomplish the same thing?
I'm fairly new to SQL Server Reporting Services, so I'm open to your suggestions and appreciate your help in advance.
IMHO if you need to historic data for safekeeping or auditing purposes I'd strongly recommend to keep the data in the database. Use a staging environment to add a timestamp to the report data so the snapshots make more sense. In this way you can use the SSRS portal later on to filter on a particular historic version (parameterized) and you don't have to build a bespoke PDF viewer. It would also save some database storage. As an alternative, you could create a subscription in SSRS, have the PDF send to a file share. Then configure a listener to that directory to get your meta information and store that reference in a database table. Needless to say I'm not a big fan of storing files in the database as file storage is cheaper than database storage most of the time.
To solve your authentication issue you might want to check up on your rsreportserver.config file on your web server as your current code suggests that your local host is unknowing of any domain. In any case you can try changing your <Authentication/> section so that it looks like this:
<Authentication>
<AuthenticationTypes>
<RSWindowsBasic>
<LogonMethod>3</LogonMethod>
<Realm></Realm>
<DefaultDomain>putyourfullyqualifieddomainnamehere</DefaultDomain>
</RSWindowsBasic>
</AuthenticationTypes>
<RSWindowsExtendedProtectionLevel>Off</RSWindowsExtendedProtectionLevel>
<RSWindowsExtendedProtectionScenario>Proxy</RSWindowsExtendedProtectionScenario>
<EnableAuthPersistence>true</EnableAuthPersistence>
</Authentication>
This will also work if your web server is behind a proxy or firewall.
Important: the content of DefaultDomain should be a FQDN, such as contoso.microsoft.com or myprimarydomain.lan
I want to take the report of last one download details from the mysql database and sent to my project manager on every monday through the email so the process remains same only date would be change dynamically so, I would like to automate this process using RPA UIpath.
Anyone could you help me to achieve this process.
Thanks
Use 'Database' package to connect to sql db and and run the query.
Schedule the program to run every Monday using Orchestrator.
Create the report with current date using DateTime function
There will be some extra steps like transforming data as necessary etc, but the basic outline of this process is as follows
Download MySQL ODBC Drivers MySQL site
Control Panel -> Setup ODBC Data Sources (32-bit) setup User or System DSN, make sure to test your connection to see if it works OK (it's similar to how you set it up in MySQL Workbench or read about it here)
In your UiPath Studio Package Manager, add Database Activities Pack.
Get your data using UiPath.Database.Activities.ExecuteQuery activity to a DataTable
Write your data to an Excel file using Write Range activity
Send your mail through SMTP using UiPath.Mail.SMTP.Activities.SendMail including freshly created Excel file as attachment
First step Take the data using database activity
Create an automation in UiPath to attach and send to your respective email
Schedule it own orchestrator.
Though not exactly but atleast sending a mail by taking credential from Orchestrator is shown in this article
https://www.c-sharpcorner.com/article/create-a-sequence-project-for-sending-a-mail-using-smtp-activity-by-taking-crede/
We have an ASP .NET MVC web application that links to some SQL Server Reporting Services reports. Our web application uses one database for the morning (let's call this the "AM database") and a different database for the afternoon/night ("PM database").
We have a SQL Server Agent job set up that switches the connection string for the web application from the AM database to the PM database (or vice-versa) on a schedule. It works by copying/replacing the MVC application's Web.config file with the appropriate AM/PM version. This works as intended.
However, the reports will remain pointed to whichever database they were using previously, unless the data source is manually changed through SSRS. These reports need to be updated to point to the same database as the MVC web app.
How can I automate this process (preferably through SQL Server Agent)? We need the reports to change their database connection on a regular interval.
This works for embedded connections I am not sure about shared data source references. Just add two parameters to your report for database name and database server name. You could also use codes or mask the names if you prefer not so send this info over the wire.
In your embedded data set add the following as your connectionstring
expression:="Data Source="+Parameters!DatabaseServerName.Value+";Initial Catalog="&Parameters!DatabaseName.Value
Next, add a defined user for your credentials then all you need to do is pass in the two params for each report from your application.
NOTE: You need to add your defaults when designing to a server that is accessible.
(distinction, I'm talking about distributing a report--not deploying a report to a report server)
To our product we've recently added support for it so it can dump various stats to a database (mssql server). Since then, I've made reports (where the datasource is my own sql server). But if I want to get these reports into the hands of customers (pointing to their own database, obviously) so they don't need to make their own (or if they don't want/can't make their own) is there a good way to do this?
I'd rather not have to give instructions on how to use the report creator and have them copy/paste what I've done nor have them open it and change the datasource. I'm completely new to using SSRS and don't know any of its intricacies. I know I can query the database to see what reports are available, is there a way to just add an entire report to the database via code (c# or java)?
Assuming that they have SSRS installed and configured, and assuming that their DB (tables, SPs etc.) match your report - one of the way this could be done is:
When creating your report use a shared datasource (don't use one embedded into report)
Ask a customer to create shared data source in their SSRS instance under the same name, but pointing to their DB
Profit! That's it, all you have to to is to give them the RDL file, they will upload it to their SSRS. It will use shared datasource they provided to pull data from their DB
I am working to deploy a reporting solution using SSRS and PerformancePoint. I have 4 databases I have pull from. 3 I have full control over the other I only have an additional domain account that has access to SQL with read only permissions, this is the only option due to the security agreement for this database.
I cannot for the life of me figure out how to publish a report using the domain account protected data. I have tried every combination of authentication I could find on google for the dataset but it just will not work.
Ideas?
My understanding is that you are not combining data from 4 different servers as your data source in this report, correct?
Then, In ReportManager - go to report properties - i.e. right-click on your report and then left-click on Manage from the dropdown menu. Then choose Data Source tab - it will have the following option:
A custom data source
Data source type: Microsoft SQL Server
Connection string: Data Source=YOUR.SERVER.IP.ADDRESS;Initial Catalog=YOUR_DATABASE_NAME
Then choose: Connect using: Credentials stored securely in the report server
You can enter your domain username and password there: e.g.
User name: SOMEDOMAIN\MyUser.Name
Password: MyPa$$wo%d
Then checkmark: Use as Windows credentials when connecting to the data source
You may need to checkmark this one too: Impersonate the authenticated user after a connection has been made to the data source
This will store your login/password combination securely on the server and will allow the report to connect to your datasource.
You can also do this for a shared datasource.
Otherwise, If you're trying to combine data from your 3 servers and 1 additional where you have read-only access only, I would recommend to:
create a linked server entry on one of your servers pointing to that 1 read-only server, and may be two more for the two other servers
create stored procedures that would provide datasets for your report gathering data from the other 3 servers as needed - this way you'd only need 1 datasource on the reportserver
Does this answer your question?