[SQL Azure] SQL Azure Reporting Previewを使ってみよう

こんにちは、Windows Azure サポートチームです。

今回は先日リリースされた、SQL Azure Reporting Preview をご紹介します。

メインの特徴は以下になります。

・Report Managerは Windows Azure Platform Management Portal を使います。
・データソースはSQL Azureを使います。
・Reporting Serverに接続するためにはWindows Azure Platform Management Portal で設定したアカウントを使います。

サンプルとしてSQL Azure上に作成したデータを参照する下記のようなレポートを作成します。

clip_image002

作業に必要なアイテム

すでにSQL Azureをご利用であることを前提としています。

1.SQL Azure Reporting Server の作成先の Windows Azure Subscription
2.SQL Azure上に存在する20MB程度の小さなサンプルテーブルを作成できる領域が確保できるデータベース
3.レポート作成ツール。ここでは下記からダウンロードできるReport Builder 3.0を使います。

Report Builder 3.0

SQL Azure Reporting Serverを作成する

まず既存のWindows AzureのアカウントでWindows Azure Platform Management Portalに接続します。

(新しいWindows Azure Platform Management Portal(管理ポータル)についての詳細はこちらをご覧ください。)接続したら、左下にある「Reporting」をクリックします。

clip_image004

SQL Azure Reporting Previewの画面が表示されます。

clip_image006

「Create a new SQL Azure Reporting Server」クリックします。使用許諾条項が表示されるので確認し、次に進みます。

clip_image008

SQL Azure Reporting Serverを作成したいサブスクリプションを選択し、また作成先の地域を選択し、次へ進みます。
ポイント:SQL Azureのサーバーが存在する地域がリストにある場合は同じ地域にReporting Serverを作成した方が通信効率を高めることができます。

clip_image010

SQL Azure Reporting Serverに接続する為のアカウントを入力し、Finishをクリックします。ここで設定したアカウントはこのBlogの後半でReporting Serverに接続する際に使います。

clip_image012

Windows Azure Platform Management Portalの左側のペインに、作成したReporting Server がリストされているのが確認できます。

作成したReporting Server をクリックすると、右側に Server Information が表示され、そこでレポート サーバーのWeb Service URLを確認することができます。

レポートサーバーのURLは、https://<Reporing Server name (10桁の記号・数字・アルファベットの組み合わせ).reporting.windows.net/reportserver となります。

以下の例では、レポートサーバーのURLは https://8aq4i6zzm8.reporting.database.windows.net/reportserver となります。

clip_image014

それでは次にレポートを作ってみましょう。また、レポートが参照するデータソースをサーバーに登録してみましょう。

(データソースは必ずしもサーバーに登録する必要はありません。)

 

データソースの作成

ここでは、例としてSQL Azureのデータベース TEST に incometaxmap というテーブルを作成します。

テーブルを以下のように作成し、下記のテーブルにあるデータをInsertします。

(Insertするためのツールとして主にWindows Azure Platform Management PortalまたはSQL Server Management Studio、SQLCMDなどが利用できます。)

テーブル作成スクリプト(SQL Azure上):

create table [test].[dbo].[incometaxmap] (id int identity primary key clustered, state varchar(50), tax decimal(10,1))

サンプルデータ(あくまでもサンプルなので、データの精度は保証しません)

id

state

tax

1

Alabama

5

2

Alaska

0

3

Arizona

4.5

4

Arkansas

7

5

California

9.3

6

Colorado

4.6

7

Connecticut

6.5

8

Delaware

6.9

9

Florida

0

10

Georgia

6

11

Hawaii

11

12

Idaho

7.8

13

Illinois

5

14

Indiana

3.4

15

Iowa

8.9

16

Kansas

6.4

17

Kentucky

6

18

Louisiana

6

19

Maine

8.5

20

Maryland

5.5

21

Massachusetts

5.3

22

Michigan

4.4

23

Minnesota

7.8

24

Mississippi

5

25

Missouri

6

26

Montana

6.9

27

Nebraska

6.8

28

Nevada

0

29

New Hampshire

0

30

New Jersey

8.9

31

New Mexico

4.9

32

New York

8.9

33

North Carolina

7.7

34

North Dakota

4.8

35

Ohio

5.9

36

Oklahoma

5.5

37

Oregon

11

38

Pennsylvania

3.1

39

Rhode Island

5.9

40

South Carolina

7

41

South Dakota

0

42

Tennessee

6

43

Texas

0

44

Utah

5

45

Vermont

8.9

46

Virginia

5.7

47

Washington

0

48

West Virginia

6.5

49

Wisconsin

7.7

50

Wyoming

0

51

District of Columbia

8.5

次に Reporting Serverにデータソースを作ってレポートから参照できるようにします。データソースを作るには、clip_image016のボタンをクリックします。

以下のダイアログが開くので、先ほど作成したテーブル「incometaxmap」が存在するSQL AzureデータベースTESTを参照するように、SQL Azure サーバー名、ログオン情報をそれぞれ指定します。

設定が終わったら、Test Connectionで接続が問題なくできるかまで確認します。

clip_image018

接続が問題なくできると、成功した旨のダイアログが表示されます。確認してCloseします。
clip_image020

作成したデータソースがリストされているのを確認します。

clip_image022

レポートの作成

次に開発環境に予めインストールしておいた Report Builder を開きます。  ( [すべてのプログラム] – [Microsoft SQL Server 2008 R2 レポート ビルダー 3.0] )

clip_image024

Report Builderを起動すると以下のような画面が表示されます。「New Report」を選択し、さらに右側のペインで「Map Wizard」をクリックします。

clip_image026

「Map Galley」を選択し、表示される一覧から「Use By State Inset」を選択し次に進みます。

clip_image028

オプションは選択せずに次に進みます。

clip_image030

「Bubble Map」を選択し、次に進みます。

clip_image032

「Add a dataset that includes fields that relate to the spatial data that you chose earlier」をクリックし、Next をクリックします。
clip_image034

次の画面で「Browse」をクリックして、データソースを選択します。
clip_image036

次の画面が表示されてくるので「Name」欄に作成したレポート サーバーの Web Service URLを入力し、EnterキーまたはOpenボタンをクリックします。

clip_image038

すると、以下の画面が表示され、先ほど作成したデータソースがリストされてきます。先ほど作成したデータソースを選択します。

clip_image040

Openボタンをクリックします。

clip_image042

次へボタンをクリックすると、データソースへの資格情報を聞かれるので入力します。

clip_image044

データソースへの接続に問題がなければ、次の画面に遷移します。ここで左側のペインにはデータソースの参照先、つまりデータベースTESTにあるテーブルがリストされます。「incometaxmap」を選択し、Nextをクリックします。

clip_image046

次に、Spatial Dataset Fields値の「STATENAME」とテーブル「incometaxmap」の「state」列をマップします。STATENAMEの左側のチェックボックスにチェックを入れると、「Analytical Dataset Fields」が選択できるようになり、テーブル「incometaxmap」の列の一覧が表示されます。一覧から「STATE」を選びます。Nextをクリックします。

clip_image048

ここでTheme(デザイン)を選び、Bubble SizesをTaxの値に応じて大きさが変わるようSum(tax)を選択します。(ひとつのSTATEに1データしか存在しませんが、こちらを選択します。)Nextをクリックします。

clip_image050

Finishをクリックし、タイトル等を編集します。

clip_image052

できあがったレポートを incometaxmap.rdl という名前でレポートサーバーに保存します。
左上にあるメニューボタンから「Save As」をクリックします。

clip_image054

Name欄に <Web service URL>/レポート名(ここではincometaxmap.rdl)を入力します。

Web Service URLは、Windows Azure Platform Management Portal から確認できます。

ここでは先ほど作成したレポートサーバーのWeb Service URL:https://8aq4i6zzm8.reporting.windows.net/reportserver を使うので、Name欄に入力するのはhttps://8aq4i6zzm8.reporting.windows.net/reportserver/incometaxmap.rdl となります。

clip_image056

レポートサーバーへの接続ログイン情報を聞かれるので、レポート サーバーを作成する際に設定したUsername/passwordを入力し、レポートサーバーに incometaxmap.rdlを保存します。

(レポート サーバー 管理ユーザを別途作成している場合は、こちらを利用することもできます。詳細はこのBlogの後方にある レポート サーバー のユーザー管理 をご覧ください。)

それでは、Reporting Server に保存されたレポートを参照してみましょう。Windows Azure Platform Management Portalにアクセスし、Reporting Server を展開します。

すると、右ペイン下の方に、アップロードしたレポート incometaxmap.rdl がリストされているのがわかります。incometaxmap.rdl(リンクが張られています)をクリックします。

clip_image058

ここで、SQL Azure Reporting へログインするための資格情報が求められます。ここでもReporting Serverへ接続可能なUsernameとPasswordを入力し、Sign Inします。(例:Reporting Serverを作成時に作成した管理ユーザ)

clip_image060

Reporting Serverにログインすると、このBlogの冒頭にあるイメージでレポートが表示されます。

補足:データソースに資格情報が保存されていない場合は、レポートを表示される前に以下の画面が表示されますので、データソースへの接続資格情報を入力し、View Reportをクリックします。

clip_image062

 

SQL Azure Reporting Server のバージョンの確認方法

Web Service URLをインターネット エクスプローラのアドレス欄に直接入力します。するとおなじみのReporting Server管理画面が表示され、下の方に現在のSQL Azure Reportingで利用されているReporting Servicesのバージョンが表示されます。

clip_image064

 

すでにあるレポート定義ファイルをレポート サーバーにアップロードして表示する方法

すでにSQL Azureをデータソースとしたレポート定義ファイルが存在する場合はclip_image066ボタンからアップロードできます。ボタンをクリックすると、ファイルを指定する画面が出てくるので、ファイルを指定し、Uploadボタンをクリックします。

clip_image067

アップロードされたレポートは以下のようにリストされます。
clip_image069

 

レポート サーバー のユーザー管理

Reporting Serverを作成する際に、管理ユーザーを作成しますが、それ以外にユーザーを追加・またはロール分けしたい場合など、clip_image071 ボタンをクリックすることで追加・管理することが可能です。

clip_image073

トラブルシューティング

clip_image075

レポートが上記の rsErrorOpeningConnection エラーで表示できない場合、SQL Azureへの資格情報がレポートに保持されていないか、資格情報のユーザー名の形式が @database.windows.net を含んでいることが原因である場合が多く報告されています。詳細は以下の記事をご覧ください。

Troubleshooting SQL Azure Reporting
social.technet.microsoft.com/wiki/contents/articles/troubleshooting-sql-azure-reporting.aspx

SQL Azure Reporting CTP アカウントを既にお持ちだった方へ

既に以前のバージョンのCTPアカウントを持っていた場合は、最終バージョンであるPreviewを利用するために必要な手続きがメールにて通知されます。

Final SQL Azure Reporting Preview Is Here!

Microsoft has extended its best-in-class reporting offering to the cloud with SQL Azure Reporting, enabling you to deliver rich insights to even more users without the need to deploy and maintain reporting infrastructure.  We are happy to announce that we just released the final Community Technology Preview (CTP) release of SQL Azure Reporting.  This new preview is immediately available within the Windows Azure Management Portal, and no separate registration process is required.  All existing SQL Azure subscribers can use the final preview release today.

(省略)

その他参考情報

SQL Azure Reporting Overview - 主な関連サイトはすべてここにまとまっています。social.technet.microsoft.com/wiki/contents/articles/sql-azure-reporting-overview.aspx

MSDN – SQL Azure Reporting Preview
msdn.microsoft.com/en-us/library/gg430130.aspx

SQL Azure Reporting Preview Release Notes
social.technet.microsoft.com/wiki/contents/articles/sql-azure-reporting-limited-ctp-release-notes.aspx

SQL Azure Reporting Previewの制限事項については下記をご覧ください
msdn.microsoft.com/en-us/library/gg430132.aspx

Troubleshooting SQL Azure Reporting
social.technet.microsoft.com/wiki/contents/articles/troubleshooting-sql-azure-reporting.aspx

SQL Azure Reporting FAQ
social.technet.microsoft.com/wiki/contents/articles/sql-azure-reporting-faq.aspx

Announcing The New SQL Azure Reporting CTP Release
blogs.msdn.com/b/windowsazure/archive/2011/10/13/announcing-sql-azure-reporting-preview-release.aspx

サンプル等
SQL Azure Reporting Samples - サンプルがダウンロードできます。サンプルデータもあります。
social.technet.microsoft.com/wiki/contents/articles/sql-azure-reporting-samples.aspx#Sampledata

SQL Azure Reporting Limited Release Report Samples
archive.msdn.microsoft.com/SQLAzureReports/Release/ProjectReleases.aspx?ReleaseId=5419

SQL Azure Reportingは現在CTPのため、Community Baseのサポートのみとなっています。SQL Server Reporting forum またはSQL Azure MSDN Forum のサイトをご活用ください。

--
Sr. Support Escalation Engineer
Kayoko Gray