building windows azure reporting services application€¦  · web viewembed the visual studio...

Post on 21-May-2020

9 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Building Windows Azure Reporting Services Application

Setup and Configuration Guide

Himanshu Gupta

Technology Solutions Professional – Data Platform

Contents

1. OVERVIEW.....................................................................................................................................1

2. OBJECTIVES...................................................................................................................................1

3. ASSUMPTIONS...............................................................................................................................2

4. CREATE WINDOWS AZURE REPORTING SERVICE.......................................................................2

5. CREATE AND DEPLOY SAMPLE REPORT TO AZURE REPORTING SERVICE..................................5

6. INSTALL WINDOWS AZURE SDK FOR .NET.....................................................................9

7. CREATE CLOUD SERVICE PROJECT.............................................................................................20

8. IMPLEMENT SERVER CREDENTIALS CLASS..................................................................................24

9. CREATE REPORT PAGE WITH REPORT VIEW CONTROL..............................................................29

10. DEPLOY APPLICATION ON WINDOWS AZURE..........................................................................41

1. OVERVIEWWindows Azure SQL Reporting is a cloud-based reporting service for the Windows Azure Platform built on SQL Server Reporting Services. SQL Reporting provides many benefits, such as

Rapid provisioning Cost-effective scalability and High availability Reduced management overhead Secure access for viewing and managing reports.

Windows Azure Reporting offers the following capabilities:

Host operational reports based on report data from existing Windows Azure SQL Database. Operational reports are report definition language (RDL) reports.

Embed the Visual Studio Report Viewer AJAX control in on-premise Web applications or cloud-based Windows Azure applications to add rich reporting to custom applications. The Report Viewer control points to reports hosted on report servers.

2. OBJECTIVESObjective of this doument is to provide you a step-by-step guide on howto use Windows Azure Reporting service from

ASP.Net application hosted on premise

ASP.Net application hosted on Windows Azure

While you can have a hybrid architecture, in this guide we will have all our components – database, reporting services and web application – on Windows Azure cloud.

3. ASSUMPTIONSIn this document, I have assumed that

You have Visual Studio 2010 or higher version installed on your development server You have an active Windows Azure subscription You have a SQL Azure database set up You have a sample SQL Server Reporting Services report that can be deployed on cloud

4. CREATE WINDOWS AZURE REPORTING SERVICEa) Login to your Windows Azure portalb) Azure reporting service management is not yet available on the new Windows Azure portal

(preview)c) In order to navigate to the old portal,

d) On the management portal, click Reporting on the left panel

a) Select your subscription on the upper left panelb) Click create on the top ribbon

c) Select subscription and regiond) Click “Next”

e) Enter administrator user ID and passwordf) Click “Finish”

5. CREATE AND DEPLOY SAMPLE REPORT TO AZURE REPORTING SERVICEWindows Azure Reporting services can only connect to Windows Azure database. In this document I am assuming that you already have Windows Azure database provisioned.

a) Select your Reporting services subscriptionb) Click “Create” Data Source in the top ribbon

c) Provide data source named) Select “Enable Data Source”e) Provide database connection string, User ID and Passwordf) Click “Test Connection”g) If successful, click “Finish”

h) Now open Report Builder or SQL Server Data Toolsi) Create a new Report projectj) Right click “Data Source” and select “Add Data Source”k) In the new data source window, select “Use a shared data source or report model”l) Click “Browse”m) Enter your Windows Azure Reporting web service URL in the “Name” text boxn) You should now see the data source you created in earlier stepso) Select this data sourcep) Click “Open” and then click “Ok”

q) Create an embedded dataset for your report using the data source created in previous step.r) Save your report on the development servers) Login to your Windows Azure portalt) Navigate to Reporting service home pageu) Select your Reporting service subscriptionv) Click “Upload” icon in Report area on the top context menu

w) Provide destination path by browsing to the location where you saved the report created in previous step.

x) Optionally, enter descriptiony) Click “Upload”

z) Verify if the report is working fine by launching it using the hyperlink

6. INSTALL WINDOWS AZURE SDK FOR .NETWindows Azure SDK for .Net provides the tools and APIs to develop, deploy, and manage scalable services on Windows Azure.

The SDK provides a simulated environment for developing and testing services your local machine. The development environment includes the following tools:

The storage emulator – that offers local storage services that act like the Blob, Queue, and Table services available in Windows Azure.

The compute emulator – that provides a process on your local machine that acts like the Windows Azure Compute service.

The CSPack command-line tool – that prepares a service for deployment, either to the compute emulator or to the Windows Azure fabric.

The CSRun command-line tool – that runs a service in the compute emulator. The DSInit command-line tool – that initializes the storage emulator in the local

environment. The CSUpload command-line tool – that verifies and uploads a VHD image file to Windows

Azure storage.

g) Navigate to http://www.windowsazure.com/en-us/h) Click “Install SDK”

i) Select version of visual studio installed on your machine. j) I am using Visual Studio 2012 for this documentation

k) When prompted, click “Save” to save installer on your local machine

l) After the installer is saved, click “Run” when prompted

m) Click “Install”

n) Click “Finish” to close the set up.

o) On certain occasions, web installer does not start automatically.p) In such cases, launch setup once again manually.

q) Click “Install”

r) Accept license agreement and click “Install” and wait for installation to complete.s) Setup will download the required components and complete installation. This step requires

internet connectivity.

t) Click “Finish”

a) Add additional components if required and click “install”b) Click “Exit”

7. CREATE CLOUD SERVICE PROJECTa) Launch Visual Studio 2010 or 2012 and select “New Project”

b) Select “Cloud” from the available project types. c) I will be using Visual C# for this set up.d) Provide project name and location. Click “Ok”.

e) Selected ASP .Net Web Rolef) Click “Edit” icon to change the name of your role and click “Ok”g) Wait till the project is created successfully.

h) A project with selected template will be created for you. i) Note that a “Windows Azure” project will be added automatically to the solution along with

the role.j) We will now start building our ASP.Net application for accessing Windows Azure Reporting

Services.

8. IMPLEMENT SERVER CREDENTIALS CLASSSQL Reporting uses cookie-based authentication. Each cookie expires after one hour. The report server sends a new cookie to the client every half-hour. When applications access a SQL Database report server, the client code must explicitly save new cookies sent by the server and return them with subsequent requests.

Refer to MSDN documentation page on details on how authentication is managed in Windows Azure Reporting Service, http://msdn.microsoft.com/en-us/library/windowsazure/gg552871.aspx

a) Go to solution explorerb) Right-click project and select Add -> New Item

c) Select “Code” as template and “Class” as type of itemd) Name this class as “ReportServerCredentials.cs”

a) If you are using C#, copy following code in the editorb) Note: Make sure that you add following namespaces to the class

o Microsoft.Reporting.WebForms;o System.Security.Principal;o System.Net;o System.Configuration;

using System;using System.Collections.Generic;using System.Linq;using System.Web;using Microsoft.Reporting.WebForms;using System.Security.Principal;using System.Net;using System.Configuration;

/// <summary>/// Implementation of IReportServerCredentials to supply forms credentials to SQL Reporting using GetFormsCredentials()

/// </summary>public class ReportServerCredentials : IReportServerCredentials{ public ReportServerCredentials() { }

public WindowsIdentity ImpersonationUser { get { return null; } }

public ICredentials NetworkCredentials { get { return null; } }

public bool GetFormsCredentials(out Cookie authCookie, out string user, out string password, out string authority) { authCookie = null;

user = ConfigurationManager.AppSettings["USERNAME"]; password = ConfigurationManager.AppSettings["PASSWORD"]; authority = ConfigurationManager.AppSettings["SERVER_NAME"];

return true; }}

a) Add configuration properties to “Web.config” or “App.config” fileo Double click web.config file so that it open in the editoro Add following lines anywhere between <Configuration> and </configuration> tags

<appSettings> <add key="SERVER_NAME" value="[Your azure reporting web service url" /> <add key="USERNAME" value="[Your user name]" /> <add key="PASSWORD" value="[Your Password]" /> <add key="REPORT_PATH" value="[Your report path]" /> </appSettings>

To get your azure reporting web service URL,

o Login to Windows Azure portalo Navigate to the reporting service management home page

As in case of SQL Server Report Service in native mode, your report path will start with “/”

9. CREATE REPORT PAGE WITH REPORT VIEW CONTROL

a) Go to solution explorerb) Right-click project and select Add -> New Item

c) Select “Web” template under C#d) Select “Web Form” as page typee) Provide name of the page and click “Ok”

f) Go to page design tabg) Open Toolbox on the left paneh) Expand Report sub-menu and hold “ReportViewer” and drag it on the page

i) Select “Server Report” in the report viewer tasksj) Press F4 or right click the report view control and select properties

k) Azure Reporting Services report MUST run in remote mode in ASP.Net page. Change report “ProcessingMode” to “Remote”.

a) Report Viewer control in Visual Studio 2010 and above require Script Manager to be included on the page.

b) Expand AJAX sub-menu in toolboxc) Hold and drag “Script Manager” component on the page

d) Open class file (.cs file) for your report page and add following method

protected void Page_init(object sender, EventArgs e) { ReportViewer1.ServerReport.ReportServerUrl = new Uri(String.Format("https://{0}/reportserver", ConfigurationManager.AppSettings["SERVER_NAME"])); ReportViewer1.ServerReport.ReportPath = ConfigurationManager.AppSettings["REPORT_PATH"]; ReportViewer1.ServerReport.ReportServerCredentials = new ReportServerCredentials(); }

e) Now the last step is to link our report page with the default landing page of our applicationf) Open “Default.aspx” page and edit it as per your requirementsg) For this set up, I will remove all standard text and added a hyperlink to the report page we

created earlier

h) Now we are ready to test our ASP.Net web application accessing Windows Azure Reporting service

i) Press F5

Click on the hyperlink

10. DEPLOY APPLICATION ON WINDOWS AZUREWe are now ready to deploy our reporting application on Windows Azure cloud. Our windows azure SDK provides a clean and easy means for deployment.

a) Open your solution in visual studiob) Right click the project in solution explorerc) Select “Publish to Windows Azure”

d) If you have not set up your subscription earlier (which may be a likely case), select “Manage” from the drop down

e) Click “New” to create a new subscriptionf) “New Subscription” dialog will now openg) You will need a self-signed certificate in order to sign in and set up your publication

subscription.h) If you have not created a certificate before, select “Create” under “Create or Select an

existing certificate for authentication”

i) Provide a friendly name for your certificate and click “Ok”. At this point a self-signed certificate is created on your local machine.

j) We will now load this certificate on your Windows Azure subscription so that authentication can be established.

k) Click “Copy the full Path” on point (2) in the windowl) Logon to your Windows Azure portalm) Select “Hosted Service, Storage Account and CDN” on the lower left panel n) Select “Management Certificates” in the top left panelo) Click “Add Certificate” in the top context menu

p) On the Add Certificate dialog window, click “Browse”q) Copy full path that you copied in step 7 (k) abover) Click “Open”s) Click “Ok”t) The certificate will now appear in the management portal

u) Come back to “New Subscription” windowv) Enter your Windows Azure subscription ID in item (3)w) Leave “Service Management URL” in item (4) unchangedx) Provide a name for your publish subscription in item (5)y) Click “Ok”

z) The tool will now validate and authenticate your subscription and finally create your profileaa) Click “Close”bb) Return to your publish wizard

cc) Click “Next”

dd) Select cloud service region. I am selecting “East Asia” as that is closest to my locationee) Select environment – Production / Stagingff) Select build configuration – Release, Debuggg) Select configuration – Cloud, Local. We will select “Cloud”

hh) Verify details under “Advanced Settings”

ii) Click “Next”jj) Verify details on Summary pagekk) Click “Publish”

ll) Wait for build process to complete. This will take few minutes.mm) Deployment will start automatically after “Build” completes with no errors.

a) The instance will now initializeb) Login to your Windows Azure portalc) Select “Hosted Service, Storage Account and CDN” on lower left paned) Select “Hosted Service” in the upper left panee) You will now see your application getting initialized. This will take some time.

a) Your Windows Azure Reporting web application is now up and running.b) Open your favourite browser and navigate to your site, http://azurereporting.cloudapp.net

in my casec) Your Windows Azure Reporting application is now running on cloud!!!

top related