Currently Microsoft doesn’t provide a PaaS version of SQL Server Reporting Service, where you can run your server-side (.rdl) reports in the cloud. However, if you want to run reports using Microsoft reporting technology you can use Windows Azure to host your client report definition (.rdlc) in a ASP.NET web page. This techique uses the ReportViewer control (that ships with ASP.NET) to execute, generate and display the reports from Windows Azure. This allows you to have your reports in the cloud (Windows Azure) along with your data (SQL Azure). This article will cover the basics for creating a client report definition that will work with SQL Azure using Visual Studio.
If you wanted to run the ASP.NET page with the ReportViewer control pointed at SQL Azure from your local on-premise IIS server you could do that too with this technique.
Here are the steps that need to get done:
However, Visual Studio report wizard works in reverse order:
Let’s go into the steps in detail.
1) Open Visual Studio and create a new project, Choose Windows Azure Cloud Service
2) Choose the ASP.NET Web Role
3) That creates a default.aspx page. Navigate to default.aspx page and put the page into design mode.
4) Open the toolbox and drag over the MicrosoftReportViewer control found under Reporting section onto the ASP.NET page.
5) Once the ReportViewer control is embedded in the page, a quick menu will protrude from the embedded control. Choose Design a new report.
6) Once you client the Design a new report option, the Report Wizard opens and you are asked to choose a data source.
7) Click on the New Connection Button.
Currently, the ReportViewer control only allows you to create two types of data connection, using either an OLEDB or ODBC data source. While it might be tempting to try to use the SQL Server Native data source, this will not work. The SQL Server Native data source uses OLEDB and currently there isn’t an OLEDB provider for SQL Azure. Instead, you need to use the OBDC data source.
Now that we have the Add Connection dialog up, here is how to proceed to create an ODBC connection to SQL Azure:
1) Click on Change to change the data source.
2) This will bring up the Change Data Source dialog.
3) Choose the Microsoft ODBC Data Source from the Data Source dialog. Click OK.
4) This will return you to the Add Connection dialog, with the appropriate options for an ODBC data source.
5) Choose Use connection string for the Data source specification.
6) This connection string we are going to get from the SQL Azure Portal. Login to the portal, naviagte to the database that you want to connect to, select that database and press the connection string button at the bottom.
7) This will bring up the connection string dialog with the specifc information filled in for server, database and administrative login. You want to copy the ODBC connection string, by clicking on the copy to clipboard button.
8) Paste this into the Add Connection dialog under Use connection string.
9) Notice where the Pwd attribute is set to myPassword. It is very important to change this to your password for the administrator account. The one that matches the user account in the connection string. If you don’t change it now, the wizard will keep asking you for the password.
10) Click the Test Connection button to test the connection, then press OK.
11) This takes us back to the Data Source Configuration Wizard dialog with our new connection highlighted. Click on Next.
12) Choose to save the connection string, which is saved in the web.config file.
13) Choose the data objects, i.e. tables, from SQL Azure that you want to use in the report. In my screen shots I am using the AdventureWorks database.
14) Press Finish.
Now that we have the data source configured, we have to select it and create a report.
The report we are going to design creates a client report definition file (.rdlc), that gets embedded in the project files that get deployed to Windows Azure. When the page is requested the ReportViewer control loads the .rdlc file, executes the transact-sql, which calls SQL Azure, and returns the data. When the data is returned the ReportViewer control (running on Windows Azure) formats and displays the report.
1) In the Report Wizard dialog. Choose a data source and press Next.
2) Walk through the dialog to design a report, you can read more about how to do this here.
When you are done with the Report Wizard dialog you will have the report embedded in the ReportViewer, inside the ASP.NET page. Next thing to do is deploy it to Windows Azure.
Before you can deploy to Windows Azure, you need to make sure that the Windows Azure package contains all the assemblies for the ReportViewer control that are not part of the .NET framework:
These four assemblies are available only if you have Visual Studio installed or if you install the free redistributable package ReportViewer.exe. In order to get them in your Windows Azure package you need to:
You also need to make sure all the reports that you generated are tagged in your project as content, instead of embedded resources.
There is a good video about using the ReportViewer control with Windows Azure found here.
Have questions, concerns, comments? Post them below and we will try to address them.
Awesome stuff ! Will be definitely trying it out ....
You have saved my lot of time. I was missing •Microsoft.RevportViewer.DataVisualization.dll reference and the role was going in loop.
There should be proper tools to debug this azure thing.
Walter I know this is an old article. How would I display a report that is already uploaded to sql azure reporting server with the server datasource already pointing to the azure database? I have a win forms C# app with a report viewer control on it. All I want to do is display the report from the azure server in that report viewer. I do not want to create another report in VS
Hi walter, how to do this in sharepoint webpart'
I cant seem to find the the Microsoft.ReportViewer.ProcessingObjectModel.dll and Mircosoft.RevportViewer.DataVisualization.dll in GAC, not even after installing Reportviewer.exe
Where are they placed on a Win7 VS2010 machine?