├── .gitattributes ├── .gitignore ├── HOL ├── HOL0-Prepare.md ├── HOL1-EventHubs.md ├── HOL2-StreamAnalytics.md ├── HOL3-HDInsight.md ├── HOL4-PowerBI.md ├── HOL5-MachineLearning.md ├── Projects │ ├── EventHubReceiver │ │ ├── EventHubReceiver.sln │ │ └── EventHubReceiver │ │ │ ├── App.config │ │ │ ├── EventHubReceiver.csproj │ │ │ ├── Program.cs │ │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ │ ├── ReceiveProcessor.cs │ │ │ └── packages.config │ └── EventHubSender │ │ ├── EventHubSender.sln │ │ └── EventHubSender │ │ ├── App.config │ │ ├── EventHubSender.csproj │ │ ├── Program.cs │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ └── packages.config └── images │ ├── 0-signup-microsoft-azure-subscription.png │ ├── 1-add-receiveprocessor-class.png │ ├── 1-configure-event-hub-connection-string.png │ ├── 1-create-event-hub-receiver-project.png │ ├── 1-create-event-hubs-custom-step1.png │ ├── 1-create-event-hubs-custom-step2.png │ ├── 1-create-event-hubs.png │ ├── 1-create-eventhub-sender-project.png │ ├── 1-event-hubs-in-service-bus.png │ ├── 1-event-hubs-partitions.png │ ├── 1-event-hubs-primary-key-for-policies.png │ ├── 1-event-hubs-settings-page.png │ ├── 1-install-azure-service-bus-event-hub-event-processor-host.png │ ├── 1-install-azure-service-bus-sdk.png │ ├── 1-manage-nuget-pkg.png │ ├── 1-navigate-created-event-hubs.png │ ├── 1-send-recv-events.png │ ├── 1-setting-event-hubs-policies.png │ ├── 2-adding-stream-input.png │ ├── 2-adding-stream-output.png │ ├── 2-configuring-stream-data-type.png │ ├── 2-creating-stream-analytics.png │ ├── 2-intro-stream-analytics.png │ ├── 2-output-to-blob-storage.png │ ├── 2-selecting-event-hub.png │ ├── 2-selecting-stream-input-source.png │ ├── 2-selecting-stream-input.png │ ├── 2-selecting-stream-output.png │ ├── 3-creating-azure-hdinsight.png │ ├── 3-from-azure-hdinsight-storage.png │ ├── 3-hadoop-core.png │ ├── 3-hadoop-on-windows-server.png │ ├── 3-hdinsight-hive-editor.png │ ├── 3-hdinsight-query-console.png │ ├── 3-hive-table-file-created.png │ ├── 3-insert-power-view.png │ ├── 3-intro-azure-hdinsight.png │ ├── 3-line-chart-by-energy.png │ ├── 3-list-deviceids.png │ ├── 3-load-data-into-excel.png │ ├── 3-modified-column-name.png │ ├── 3-power-view-fields.png │ ├── 3-power-view-line-chart.png │ ├── 3-powerquery-azure-hdinsight.png │ ├── 3-query-console-button.png │ ├── 3-query-data-from-hive-table.png │ ├── 3-query-selector-editor.png │ ├── 3-storage-account-key.png │ ├── 3-submitting-hive-query.png │ ├── 5-adding-webservice-input-output.png │ ├── 5-api-help-page.png │ ├── 5-attaching-project-columns.png │ ├── 5-cleaning-missing-data.png │ ├── 5-creating-azure-ml-experiment.png │ ├── 5-creating-azure-ml-workspace.png │ ├── 5-draging-a-dataset.png │ ├── 5-evaluation.png │ ├── 5-including-critical-columns.png │ ├── 5-popup-menu-in-blocks.png │ ├── 5-projecting-columns-exclude.png │ ├── 5-publish-web-service.png │ ├── 5-published-web-service-page.png │ ├── 5-signin-azure-ml-studio.png │ ├── 5-spliting-dataset.png │ ├── 5-starting-blank-experiment.png │ ├── 5-test-web-service.png │ ├── 5-train-model-by-dataset.png │ ├── 5-using-evaluate-model.png │ ├── 5-using-linear-regression.png │ ├── 5-using-scoring-model.png │ └── 5-visualize-data.png ├── LICENSE ├── Presentation ├── 1. Introduction │ └── Introduction.pptx ├── 2. Data Streaming │ └── Data Streaming.pptx ├── 3. HDInsight │ └── Hadoop in Azure.pptx └── 5. Intelligence │ └── Azure Machine Learning.pptx ├── README.md └── data └── data.csv /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.sln.docstates 8 | 9 | # Build results 10 | 11 | [Dd]ebug/ 12 | [Rr]elease/ 13 | x64/ 14 | build/ 15 | [Bb]in/ 16 | [Oo]bj/ 17 | 18 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets 19 | !packages/*/build/ 20 | 21 | # MSTest test Results 22 | [Tt]est[Rr]esult*/ 23 | [Bb]uild[Ll]og.* 24 | 25 | *_i.c 26 | *_p.c 27 | *.ilk 28 | *.meta 29 | *.obj 30 | *.pch 31 | *.pdb 32 | *.pgc 33 | *.pgd 34 | *.rsp 35 | *.sbr 36 | *.tlb 37 | *.tli 38 | *.tlh 39 | *.tmp 40 | *.tmp_proj 41 | *.log 42 | *.vspscc 43 | *.vssscc 44 | .builds 45 | *.pidb 46 | *.log 47 | *.scc 48 | 49 | # Visual C++ cache files 50 | ipch/ 51 | *.aps 52 | *.ncb 53 | *.opensdf 54 | *.sdf 55 | *.cachefile 56 | 57 | # Visual Studio profiler 58 | *.psess 59 | *.vsp 60 | *.vspx 61 | 62 | # Guidance Automation Toolkit 63 | *.gpState 64 | 65 | # ReSharper is a .NET coding add-in 66 | _ReSharper*/ 67 | *.[Rr]e[Ss]harper 68 | 69 | # TeamCity is a build add-in 70 | _TeamCity* 71 | 72 | # DotCover is a Code Coverage Tool 73 | *.dotCover 74 | 75 | # NCrunch 76 | *.ncrunch* 77 | .*crunch*.local.xml 78 | 79 | # Installshield output folder 80 | [Ee]xpress/ 81 | 82 | # DocProject is a documentation generator add-in 83 | DocProject/buildhelp/ 84 | DocProject/Help/*.HxT 85 | DocProject/Help/*.HxC 86 | DocProject/Help/*.hhc 87 | DocProject/Help/*.hhk 88 | DocProject/Help/*.hhp 89 | DocProject/Help/Html2 90 | DocProject/Help/html 91 | 92 | # Click-Once directory 93 | publish/ 94 | 95 | # Publish Web Output 96 | *.Publish.xml 97 | 98 | # NuGet Packages Directory 99 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 100 | #packages/ 101 | 102 | # Windows Azure Build Output 103 | csx 104 | *.build.csdef 105 | 106 | # Windows Store app package directory 107 | AppPackages/ 108 | 109 | # Others 110 | sql/ 111 | *.Cache 112 | ClientBin/ 113 | [Ss]tyle[Cc]op.* 114 | ~$* 115 | *~ 116 | *.dbmdl 117 | *.[Pp]ublish.xml 118 | *.pfx 119 | *.publishsettings 120 | 121 | # RIA/Silverlight projects 122 | Generated_Code/ 123 | 124 | # Backup & report files from converting an old project file to a newer 125 | # Visual Studio version. Backup files are not needed, because we have git ;-) 126 | _UpgradeReport_Files/ 127 | Backup*/ 128 | UpgradeLog*.XML 129 | UpgradeLog*.htm 130 | 131 | # SQL Server files 132 | App_Data/*.mdf 133 | App_Data/*.ldf 134 | 135 | 136 | #LightSwitch generated files 137 | GeneratedArtifacts/ 138 | _Pvt_Extensions/ 139 | ModelManifest.xml 140 | 141 | # ========================= 142 | # Windows detritus 143 | # ========================= 144 | 145 | # Windows image file caches 146 | Thumbs.db 147 | ehthumbs.db 148 | 149 | # Folder config file 150 | Desktop.ini 151 | 152 | # Recycle Bin used on file shares 153 | $RECYCLE.BIN/ 154 | 155 | # Mac desktop service store files 156 | .DS_Store 157 | -------------------------------------------------------------------------------- /HOL/HOL0-Prepare.md: -------------------------------------------------------------------------------- 1 | # Hands on Lab 0 - 準備工作 # 2 | 3 | 操作時間: **30 分鐘** 4 | 5 | 6 | # 1. 申請 Azure 訂閱 # 7 | 8 | ## 一般免費試用 ## 9 | 10 | 在操作本教材前,必須先確認是否擁有 Microsoft Azure 的訂閱帳戶,若尚未申請,請參考 [Azure 食譜 - 1.1 建立 Microsoft Azure 訂閱帳戶](http://book.azure-recipes.tw/chapter01/01_signup.html) 上的文章申請免費試用 30 天(含新台幣 6,300 元額度)。 11 | 12 | ## 使用特殊訂閱服務開始 ## 13 | 14 | 若您欲採用其它方式購買 Microsoft Azure 的訂閱帳戶(如:**Azure in Open**),請使用 https://account.windowsazure.com/signup?showCatalog=True 這個連結,登入 Microsoft 帳號(以前稱作 MSN 帳號或 Windows Live ID)後選擇對應的服務購買。 15 | 16 | ![購買 Microsoft Azure 訂閱](images/0-signup-microsoft-azure-subscription.png) 17 | 18 | # 2. 建立 Azure 儲存體帳戶 # 19 | 20 | 因為在操作 Azure IoT Suite 的相關 labs 中經常會用到 Azure Blob 儲存體,所以為了之後的操作方式便,可以先建立一個儲存體帳戶以便後續使用。 21 | 22 | 建立方式請參考 [Azure 食譜 - 4.1 建立儲存體帳號](http://book.azure-recipes.tw/chapter04/01_create_storage_account.html)。 23 | 24 | 25 | # 3. 安裝軟體 # 26 | 27 | 操作過程中可能會使用到下列軟體: 28 | 29 | 1. Visual Studio 2013 以上(**Community**, Professional, Premium, Ultimate 版本都可以)。 30 | 2. Excel 2013 ProPlus 以上。 31 | 3. [AzCopy](http://aka.ms/downloadazcopy) - 用來上傳檔案至 Azure 儲存體,詳見[使用說明](http://aka.ms/azcopy)。 32 | 33 | 34 | # 4. 善用論壇 # 35 | 36 | 請多多利用 [MSDN 論壇 - Microsoft Azure PaaS 服務](https://social.msdn.microsoft.com/Forums/zh-TW/home?forum=2199) 的論壇來發問及交流。 37 | 38 | # 5. 遭遇問題# 39 | 40 | 當您在建立 Azure 帳號的過程中,遭遇一些問題時,請您參考以下流程,讓微軟客戶支援服務團隊透過電子郵件或電話的方式,進一步協助您排除狀況。 41 | 1. 登入到 http://support.microsoft.com/oas/?prid=15470&ln=en-us 42 | 2. 於選單內,選擇符合您遭遇情境的描述。 43 | 3. 填寫聯絡資訊與問題描述。(可使用中文描述) 44 | 4. 送出表單後,微軟的客戶支援服務團隊會主動與您聯繫,並協助您排除問題。 45 | -------------------------------------------------------------------------------- /HOL/HOL1-EventHubs.md: -------------------------------------------------------------------------------- 1 | # Hands on Lab 1 - 使用 Azure Event Hubs # 2 | 3 | 操作時間:**30 分鐘** 4 | 5 | 事前準備:**擁有 Microsoft Azure 的訂閱帳戶並且能夠開通服務**。 6 | 7 | 8 | # 1. Azure Event Hubs # 9 | 10 | 想像一種 IoT 情境 -- 你佈建了很多感測器,而它們不斷傳送大量的資料出來,如果讓這些感測器直接將資料寫入儲存體,I/O 寫入的速度可能追不上資料產生的速度,Event Hubs 就是為了能在短時間處理大量資料(如:每秒數百萬計)的佇列(queue)服務,它提供簡單的讀寫操作,而且通用的網路通訊協定(HTTP、AMQP),讓感測器可以很快地將資料先送到 Event Hubs 中(而且還不限前端 IoT 裝置使用何種技術平台),然後在時效之前將這些資料取出寫進(永久)儲存體中,這可以幫助開發人員節省力氣處理資料頻寬的問題。 11 | 12 | ![Event Hubs](images/1-send-recv-events.png) 13 | 14 | ## Event Hubs 的技術 ## 15 | 16 | ![Event Hubs 與 Service Bus](images/1-event-hubs-in-service-bus.png) 17 | 18 | Event Hubs 是 [Azure Service Bus](http://azure.microsoft.com/zh-tw/services/service-bus/)(服務匯流排)中的一個特殊的佇列服務,連線與身份驗證的部份與 Service Bus 其它的服務一致,但是佇列結構有些不同,在 Event Hubs 中有**分割 (partition)** 的概念,這與 Event Hubs 能處理資料的頻寬有關,愈多的分割區就能提供更高的資料處理頻寬。你可以在 Event Hubs 中建立 8 ~ 32 個分割。 19 | 20 | ![Event Hubs 的資料分割](images/1-event-hubs-partitions.png) 21 | 22 | # 2. 建立 Event Hubs 服務 23 | 24 | 所需時間: **5 分鐘** 25 | 26 | 1. 在 [Microsoft Azure 的管理後台](https://manage.windowsazure.com/),點擊左下角的_「+ 新增」_,選擇_「應用程式服務」_ » _「服務匯流排」_ » _「事件中心」_ ,選擇**自訂建立**。 27 | 28 | ![建立 Event Hubs](images/1-create-event-hubs.png) 29 | 30 | 2. 第一步,輸入 **事件中心名稱**,這個是 Event Hubs 的名字,之後使用程式介接時會用到這個名稱;資料中心的地區選擇 **東亞**,然後建立一個新的命名空間,這個是 Azure 服務匯流排(Service Bus)的名稱,必須取一個全球唯一的名稱,欄位後方會顯示該名稱是否可用。(Event Hubs 是服務匯流排裡的一個服務,所以服務的 URL 位址是以服務匯流排的 URL 為準) 31 | 32 | ![設定 Event Hubs 以及 Service Bus 的名稱](images/1-create-event-hubs-custom-step1.png) 33 | 34 | 3. 接著按下一步,設定 Event Hubs 的分割(partition)以及訊息要保留在 Event Hubs 裡多久,這裡我們設定_分割_為 **16**,_訊息保留_ **1** 天。 35 | 36 | ![設定 Event Hubs 的分割數及保留時間](images/1-create-event-hubs-custom-step2.png) 37 | 38 | 39 | 4. 最後,按下右下角的勾勾按鈕,完成建立。 40 | 41 | # 3. 設定 Event Hubs 的存取原則 42 | 43 | 所需時間: **5 分鐘** 44 | 45 | 為了讓程式能接上 Event Hubs 來_傳送_或_接收_訊息,我們必須設定存取原則,讓程式使用不同的金鑰來傳送或接收(或是同時能傳也能收),做到權限的區分。 46 | 47 | 1. 在 [Microsoft Azure 的管理後台](https://manage.windowsazure.com/),到剛才建立的服務匯流排中,切換到**事件中心**的頁面。 48 | 49 | ![打開建立的 Event Hubs](images/1-navigate-created-event-hubs.png) 50 | 51 | 2. 進入建立好的 Event Hubs,切換到**設定**的頁面,你也可以在這頁修改訊息保留的時間。 52 | 53 | ![Event Hubs 的設定頁面](images/1-event-hubs-settings-page.png) 54 | 55 | 3. 在 Event Hubs 的**設定**頁面下方的_「共用存取原則」_,新增兩個傳送訊息的原則,一個名稱為 **SendPolicy**,權限選擇**傳送**;另一個名稱為 **RecvPolicy**,權限選擇**接聽**。 56 | 57 | ![設定 Event Hubs 的共用存取原則](images/1-setting-event-hubs-policies.png) 58 | 59 | 4. 最後按下下方工作列的**儲存**按鈕,確定將新增的存取原則儲存。如果設定正確,你會在同一個頁面最下方看到_「共用存取金鑰產生器」_區域,這裡就可以取得不同原則的金鑰。 60 | 61 | 62 | ![Event Hubs 的共用存取原則金鑰](images/1-event-hubs-primary-key-for-policies.png) 63 | 64 | 65 | # 4. 傳送訊息到 Event Hubs 66 | 67 | 所需時間: **10 分鐘** 68 | 69 | 1. 開啟 Visual Studio,按下_「新增專案」_,從範本中選擇 _Visual C#_ » _Windows_ » _Windows 桌面_ ,建立一個 **主控台應用程式(Console Application)**,名稱可以取作 **EventHubSender**。 70 | 71 | ![建立 Console App 專案](images/1-create-eventhub-sender-project.png) 72 | 73 | 2. 接下來準備安裝 Azure Service Bus SDK 來存取 Event Hubs,在專案上按右鍵,選擇**管理 NuGet 套件...**。 74 | 75 | ![透過 NuGet 安裝 Azure Service Bus SDK](images/1-manage-nuget-pkg.png) 76 | 77 | 3. 在 NuGet 套件管理員中,搜尋 _Azure Service Bus_ 找到官方發行的 SDK 後安裝。 78 | 79 | ![安裝 Azure Service Bus SDK](images/1-install-azure-service-bus-sdk.png) 80 | 81 | 4. 將下列程式碼貼到 **Program.cs** 檔案中,貼上後,記得將 ```eventHubName``` 的數值修改為您前面設定的 Event Hub 名稱(不是 Service Bus 的名稱),而 ```connectionString``` 修改為前述設定存取原則時,傳送訊息原則的連接字串: 82 | 83 | ```csharp 84 | using System; 85 | using System.Text; 86 | using System.Threading.Tasks; 87 | using Microsoft.ServiceBus.Messaging; 88 | 89 | namespace EventHubSender 90 | { 91 | class Program 92 | { 93 | static string eventHubName = "你的事件中樞名稱"; 94 | static string connectionString = "你的連接字串"; 95 | 96 | static void Main(string[] args) 97 | { 98 | Console.WriteLine("按下 Ctrl-C 來停止傳送訊息"); 99 | Console.WriteLine("按下 Enter 鍵後開始傳送訊息"); 100 | Console.ReadLine(); 101 | SendingRandomMessages().Wait(); 102 | } 103 | 104 | static async Task SendingRandomMessages() 105 | { 106 | var eventHubClient = EventHubClient.CreateFromConnectionString(connectionString, eventHubName); 107 | var random = new Random(); 108 | while (true) 109 | { 110 | var guid = Guid.NewGuid().ToString(); 111 | var time = DateTime.Now.ToString(); 112 | var thermal = random.Next(195, 265) / 10.0 ; 113 | var humidity = random.Next(58, 82); 114 | var message = "{\"id\":\""+guid+"\", \"thermal\":"+thermal+", \"humidity\":"+humidity+", \"time\":\""+time+"\"}"; 115 | 116 | try 117 | { 118 | Console.WriteLine("{0} > 傳送訊息:{1}", time, message); 119 | await eventHubClient.SendAsync(new EventData(Encoding.UTF8.GetBytes(message))); 120 | } 121 | catch (Exception exception) 122 | { 123 | Console.ForegroundColor = ConsoleColor.Red; 124 | Console.WriteLine("{0} > 例外狀況:{1}", time, exception.Message); 125 | Console.ResetColor(); 126 | } 127 | 128 | await Task.Delay(200); 129 | } 130 | } 131 | } 132 | } 133 | ``` 134 | 5. 這個程式執行後,按下 Enter 就會開始不斷送出訊息(真正送訊息的是 ```await eventHubClient.SendAsync(new EventData(Encoding.UTF8.GetBytes(message)));``` 這一段),直到您按下 Ctrl+C 後才會停止送訊息到 Azure Event Hubs 上。 135 | 136 | # 5. 從 Event Hubs 中取出訊息 137 | 138 | 所需時間: **10 分鐘** 139 | 140 | 1. 開啟 Visual Studio,按下_「新增專案」_,從範本中選擇 _Visual C#_ » _Windows_ » _Windows 桌面_ ,建立一個 **主控台應用程式(Console Application)**,名稱可以取作 **EventHubReceiver**。 141 | 142 | ![建立 EventHubReceiver 專案](images/1-create-event-hub-receiver-project.png) 143 | 144 | 2. 接下來準備安裝 Azure Service Bus SDK 來存取 Event Hubs,在專案上按右鍵,選擇**管理 NuGet 套件...**。 145 | 146 | ![透過 NuGet 安裝 Azure Service Bus SDK](images/1-manage-nuget-pkg.png) 147 | 148 | 3. 在 NuGet 套件管理員中,搜尋 _Azure Service Bus Event Hub EventProcessorHost_ 找到官方發行的 SDK 後安裝。 149 | 150 | ![安裝 Azure Service Bus SDK](images/1-install-azure-service-bus-event-hub-event-processor-host.png) 151 | 152 | 4. 在專案中右鍵新增類別,名稱為 **ReceiveProcessor.cs**。 153 | 154 | ![新增 ReceiveProcessor 類別](images/1-add-receiveprocessor-class.png) 155 | 156 | 5. 將下列程式碼貼在 **ReceiveProcessor.cs** 檔案裡: 157 | 158 | ```csharp 159 | using System; 160 | using System.Collections.Generic; 161 | using System.Diagnostics; 162 | using System.Text; 163 | using System.Threading.Tasks; 164 | using Microsoft.ServiceBus.Messaging; 165 | 166 | namespace EventHubReceiver 167 | { 168 | class ReceiveProcessor : IEventProcessor 169 | { 170 | Stopwatch checkpointStopWatch; 171 | 172 | async Task IEventProcessor.CloseAsync(PartitionContext context, CloseReason reason) 173 | { 174 | Console.WriteLine(string.Format("Processor Shuting Down.Partition '{0}', Reason:'{1}'.", context.Lease.PartitionId, reason.ToString())); 175 | if (reason == CloseReason.Shutdown) 176 | { 177 | await context.CheckpointAsync(); 178 | } 179 | } 180 | 181 | Task IEventProcessor.OpenAsync(PartitionContext context) 182 | { 183 | Console.WriteLine(string.Format("SimpleEventProcessor initialize.Partition:'{0}', Offset:'{1}'", context.Lease.PartitionId, context.Lease.Offset)); 184 | this.checkpointStopWatch = new Stopwatch(); 185 | this.checkpointStopWatch.Start(); 186 | return Task.FromResult(null); 187 | } 188 | 189 | async Task IEventProcessor.ProcessEventsAsync(PartitionContext context, IEnumerable messages) 190 | { 191 | foreach (EventData eventData in messages) 192 | { 193 | string data = Encoding.UTF8.GetString(eventData.GetBytes()); 194 | 195 | Console.WriteLine(string.Format("Message received.Partition:'{0}', Data:'{1}'", 196 | context.Lease.PartitionId, data)); 197 | } 198 | 199 | //Call checkpoint every 5 minutes, so that worker can resume processing from the 5 minutes back if it restarts. 200 | if (this.checkpointStopWatch.Elapsed > TimeSpan.FromMinutes(5)) 201 | { 202 | await context.CheckpointAsync(); 203 | this.checkpointStopWatch.Restart(); 204 | } 205 | } 206 | } 207 | } 208 | ``` 209 | 210 | 6. 回到 **Program.cs**,將下列程式碼貼入,這裡除了要填入事件中樞的名稱之外,也要使用有讀取訊息原則的連接字串,還要填入一個 Azure 儲存體的帳號資料用來存放操作的記錄檔,所以要到 Azure 上建立一個儲存體帳戶再取得存取金鑰填入 211 | 212 | ```csharp 213 | using System; 214 | using Microsoft.ServiceBus.Messaging; 215 | 216 | namespace EventHubReceiver 217 | { 218 | class Program 219 | { 220 | static void Main(string[] args) 221 | { 222 | string eventHubConnectionString = "讀取原則的連接字串"; 223 | string eventHubName = "事件中樞名稱"; 224 | string storageAccountName = "儲存體帳戶名稱"; 225 | string storageAccountKey = "儲存體存取金鑰"; 226 | string storageConnectionString = string.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}", 227 | storageAccountName, storageAccountKey); 228 | 229 | string eventProcessorHostName = Guid.NewGuid().ToString(); 230 | EventProcessorHost eventProcessorHost = new EventProcessorHost(eventProcessorHostName, eventHubName, EventHubConsumerGroup.DefaultGroupName, eventHubConnectionString, storageConnectionString); 231 | eventProcessorHost.RegisterEventProcessorAsync().Wait(); 232 | 233 | Console.WriteLine("Receiving.Press enter key to stop worker."); 234 | Console.ReadLine(); 235 | } 236 | } 237 | } 238 | ``` 239 | 240 | 7. 開始執行後,就可以看到這個程式會從 Event Hub 中取出訊息。 -------------------------------------------------------------------------------- /HOL/HOL2-StreamAnalytics.md: -------------------------------------------------------------------------------- 1 | # Hands on Lab 2 - 使用 Azure Stream Analytics # 2 | 3 | 操作時間: **30 分鐘** 4 | 5 | 事前準備: 6 | 7 | 1. **擁有 Microsoft Azure 的訂閱帳戶並且能夠開通服務**。 8 | 2. 完成 [Hands-on Lab 1 - 使用 Azure Event Hubs](HOL1-EventHubs.md) 9 | 10 | 11 | # 1. Azure Stream Analytics # 12 | 13 | 若希望在資料進 Event Hubs 時就即時地針對這些資料做處理(可能等不及寫入儲存),這時就能利用 Azure Stream Analytics (資料流分析)服務來完成。 14 | 15 | ![Azure Stream Analytics](images/2-intro-stream-analytics.png) 16 | 17 | # 2. 建立 Azure 資料流分析工作 # 18 | 19 | 所需時間: **5 分鐘** 20 | 21 | 1. 在 [Microsoft Azure 的管理後台](https://manage.windowsazure.com/),點擊左下角的_「+ 新增」_,選擇_「資料服務」_ » _「串流分析」_ 就可以設定名稱、選擇資料中心並設定搭配的儲存體帳戶,就能快速建立一個 Azure 資料流分析的工作。 22 | 23 | ![建立 Azure Stream Analytics](images/2-creating-stream-analytics.png) 24 | 25 | 2. 建立好 Azure 資料流分析後,可以在管理頁面中的**輸入**頁籤加入要監控的資料來源。 26 | 27 | ![加入資料流](images/2-adding-stream-input.png) 28 | 29 | 3. 點擊**加入輸入**後會出現一個對話盒,這裡我們選擇加入**資料流(stream)**。 30 | 31 | ![加入資料流](images/2-selecting-stream-input.png) 32 | 33 | 4. 下一步選擇資料流的來源,這裡因為我們選擇**事件中心(event hubs)**。 34 | 35 | ![選擇資料流來源](images/2-selecting-stream-input-source.png) 36 | 37 | 5. 接著是選擇要監控的 event hubs,以及這個分析工作的名稱,權限及取用者群組的部份就根據需求來設定。 38 | 39 | ![選擇要監控的事件中心](images/2-selecting-event-hub.png) 40 | 41 | 6. 最後一步,為了讓 Azure 資料流分析認得傳入 event hub 的資料是什麼_格式_(目前支援 _Avro_、_CSV_ 及 _JSON_)及_字元編碼_,在建立前可以先做設定(事後再到管理頁面修改也可以)。 42 | 43 | ![設定傳入 event hub 的資料格式](images/2-configuring-stream-data-type.png) 44 | 45 | 7. 這些設定完成後就建好了資料流分析工作。 46 | 47 | 48 | # 3. 設定資料流輸出位置 # 49 | 50 | 所需時間: **3 分鐘** 51 | 52 | 1. 在開始設定分析工作之前,可以先設定好當分析工作結束後要將結果輸出到哪一個儲存環境,在 Azure Stream Analytics 的服務管理頁面,選擇**輸出**的頁籤開始建立輸出位置。 53 | 54 | ![設定分析工作的輸出位置](images/2-adding-stream-output.png) 55 | 56 | 2. 輸出的位置可以選擇 _SQL 資料庫_、_BLOB 儲存體_、_事件中心 (Event Hubs)_ 以及 _Table 儲存體_。 57 | 58 | ![選擇分析工作的輸出位置](images/2-selecting-stream-output.png) 59 | 60 | 3. 若選擇 _BLOB 儲存體_就再設定相關的資訊,最後再輸出資料格式以及字元編碼就可以完成建立。 61 | 62 | ![輸出至 BLOB 儲存體](images/2-output-to-blob-storage.png) 63 | 64 | # 4. 設定查詢工作及啟動 # 65 | 66 | 所需時間: **10 分鐘** 67 | 68 | 1. Azure Stream Analytics 提供一種類似 SQL 查詢語法的方式讓你設定在資料流的分析工作中,在管理頁面中選擇**查詢**的頁籤就可以設定,然後用 ```INTO``` 子句將結果送到前面設定的輸出位置,用 ```FROM``` 設定資料來源(使用設定的別名)。所以設定的查詢語法可能會像是這樣: 69 | 70 | ```sql 71 | SELECT 72 | * 73 | INTO 74 | myoutput 75 | FROM 76 | mydata 77 | WHERE 78 | thermal > 26 79 | ``` 80 | 81 | 2. 在 Azure Stream Analytics 的管理頁面下方工作列按下**開始**的按鈕便可以啟動資料流分析工作,而要停止時也是在相同的地方按下停止按鈕。而啟動工作後,如果進 Event Hub 的資料符合設定的查詢條件,就會根據設定將資料輸出到設定的位置。 82 | 83 | 3. 啟動在 Hands on Lab 1 的 **EventHubSender** 專案開始送出訊息,然後在設定的輸出儲存體中查看由串流分析所取出的內容。 84 | 85 | 86 | ## 參考資料 87 | 88 | * [Azure 資料流分析簡介](http://azure.microsoft.com/zh-tw/documentation/articles/stream-analytics-introduction/) 89 | * [開始使用 Azure 資料流分析](http://azure.microsoft.com/zh-tw/documentation/articles/stream-analytics-get-started/) 90 | * [Azure 資料流分析查詢語言參考](https://msdn.microsoft.com/zh-tw/library/dn834998.aspx) 91 | -------------------------------------------------------------------------------- /HOL/HOL3-HDInsight.md: -------------------------------------------------------------------------------- 1 | # Hands on Lab 3 - 使用 Azure HDInsight # 2 | 3 | 操作時間: **60 分鐘** 4 | 5 | 事前準備: 6 | 7 | 1. **擁有 Microsoft Azure 的訂閱帳戶並且能夠開通服務**。 8 | 2. 至少有一個儲存體帳戶,可以參考[這份食譜](http://book.azure-recipes.tw/chapter04/01_create_storage_account.html)的步驟。 9 | 3. 完成: 10 | * [Hands-on Lab 1 - 使用 Azure Event Hubs](HOL1-EventHubs.md) 11 | * [Hands on Lab 2 - 使用 Azure Stream Analytics](HOL2-StreamAnalytics.md) 12 | 13 | 目標完成: 14 | 15 | * 使用 Hive 建立資料表。 16 | 17 | # 1. Azure HDInsight # 18 | 19 | ## Apache Hadoop 專案 ## 20 | 21 | [Apache Hadoop](http://hadoop.apache.org/) 是基於 MapReduce 技術,特別用來操作或儲存海量資料所開發的一個開源專案,除了可以用分散式的運算模型來平行化處理複雜的運算之外,它的架構設計上也大大降低了資料延展的複雜度。 22 | 23 | ![Apache Hadoop 核心](images/3-hadoop-core.png) 24 | 25 | 而除了儲存及操作海量資料外,因為很多人有不同操作資料的動機及需求,於是基於 Hadoop 專案也衍生了許多不同的專案,也造就了一個 Hadoop 的生態系。 26 | 27 | ## Azure HDInsight ## 28 | 29 | Azure HDInsight 是 Microsoft Azure 與 Horton Networks 公司合作將 Apache Hadoop 專案移植到 Microsoft Azure 上的服務名稱,這意味著使用 Azure HDInsight 就跟操作 Hadoop 是一模一樣的,除了既有基於 Hadoop 開發出來的工具(如:[Hive](https://hive.apache.org/), [Pig](https://pig.apache.org/) 等)可以沿用、Azure HDInsight 還加入了一些關於 .NET、ODBC 驅動程式等擴充支援性,還不用自己架設及管理 Hadoop 的運算叢集,直接在 Microsoft Azure 上建立服務,並根據需要及負擔的價格來選擇運算資源的多寡。而在 Azure HDInsight 上的 Hadoop 版本已經可以直接處理放在 Azure BLOB 儲存體的資料,十分方便。 30 | 31 | ![Azure HDInsight](images/3-intro-azure-hdinsight.png) 32 | 33 | # 2. 建立 Azure HDInsight 服務 # 34 | 35 | 操作時間: **10 分鐘** 36 | 37 | 1. 在 [Microsoft Azure 的管理後台](https://manage.windowsazure.com/),點擊左下角的_「+ 新增」_,選擇_「資料服務」_ » _「HDINSIGHT」_ » _「HADOOP」_,接著設定**名稱**(用來連結叢集)、**叢集大小**、連結 HDInsight 的**帳號密碼**、以及使用的**儲存體**。 38 | 39 | ![建立 Azure HDInsight 服務](images/3-creating-azure-hdinsight.png) 40 | 41 | 上述的步驟是建立以 Windows Server 為基礎的 Hadoop 環境,您也可以選擇「LINUX 上的 HADOOP」來建立以 (Ubuntu) Linux 為基礎的 Hadoop 環境。 42 | 43 | 2. 根據選擇的叢集大小需要一點時間建立服務,建立完成後,就可以直接將需要 Hadoop 執行的工作丟上這個服務上執行(Windows Server 為基礎的 Hadoop 用 PowerShell 來遞交工作;Linux 為基礎的 Hadoop 則用 SSH 來遞交)。 44 | 45 | ![基於 Windows Server 的 HDInsight 服務](images/3-hadoop-on-windows-server.png) 46 | 47 | # 3. 建立 Hive 查詢表 # 48 | 49 | 操作時間: **30 分鐘** 50 | 51 | ## Hive 簡介 52 | 53 | [Apache Hive](https://hive.apache.org/) 是基於 Apache Hadoop 專案所發展的一個查詢語法開源專案,透過 Hive 可以使用類似 SQL 的語法,稱為 _HiveQL_,可將儲存在 Hadoop 中的非結構化資料建立出具有結構的資料表(table),而這個 HiveQL 的查詢語句也是由 Hadoop 中的 MapReduce 基礎來執行,所以也很適合用來處理巨量資料。 54 | 55 | 接下來我們會以 HiveQL 的操作來建立 Hive 資料表。 56 | 57 | ## 上傳資料 58 | 59 | 為了完成後續的操作,首先要放一些檔案在 Azure Blob 儲存體中讓 Azure HDInsight 來讀取操作。 60 | 61 | 1. 下載並安裝 [AzCopy](http://aka.ms/downloadazcopy) 工具方便讓我們把檔案上傳至 Azure HDInsight 對應的 Blob 儲存體。 62 | 63 | 2. 下載範例檔案 [data.csv](../data/data.csv),這是一個模擬 IoT 裝置送到儲存體中的資料,裡面包含像是感測器測到的溫度、溼度、能源、光線等數值的資料(約 6 萬筆資料)。 64 | 65 | 3. 打開**命令提示字元**,切換目錄到 _C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy_,執行下列指令,其中要將 Azure Blob 儲存體的帳號名稱、存取金鑰以及 data.csv 檔案的路徑換成你建立的資料。**別忘了先在儲存體帳戶下建立一個 _data_ 的容器**。 66 | 67 | AzCopy /Source:"data.csv目錄" /Pattern:data.csv /Dest:https://儲存體帳號名稱.blob.core.windows.net/data/input /DestKey:儲存體存取金鑰 68 | 69 | ## 使用 Web 主控台來操作 Hive 查詢 70 | 71 | 1. 在建好的 Azure HDInsight 管理後台中,可以按下下方工作列的**查詢主控台(QUERY CONSOLE)**來進入由 Azure HDInsight 準備的一個 Web 操作介面來執行 Hive 查詢。 72 | 73 | 如果是建立 Hadoop on Linux 的 HDInsight 服務,那會是透過 AMBARI WEB 操作介面。 74 | 75 | ![查詢主控台按鈕](images/3-query-console-button.png) 76 | 77 | 2. 跳出帳號密碼對話盒時,輸入在建立 HDInsight 服務時所設定的管理者帳號及密碼,就會登入這個查詢主控台的頁面,左下方的下拉式選單可以切換介面語言。 78 | 79 | ![HDInsight 查詢主控台](images/3-hdinsight-query-console.png) 80 | 81 | 3. 你可以在查詢主控台中看到一些範例、工作歷史記錄、或是瀏覽儲存體內的檔案,也可以使用 **Hive 編輯器** 來執行 Hive 查詢語句。 82 | 83 | ![HDInsight 查詢主控台中的 Hive 編輯器](images/3-hdinsight-hive-editor.png) 84 | 85 | ## 建立 Hive 查詢表 86 | 87 | ### 建立 DeviceReadings 資料表 88 | 89 | 1. 在 Hive 編輯器中,輸入下列語法先建立一個 EXTERNAL 的 Hive 資料表,而資料輸入的 Blob 儲存體位址也要換成您所建立的 URL(URL中的 ```data``` 就是容器名稱)。修改完畢後,可以將這個查詢名稱定為 **DeviceReadings** 方便查詢工作記錄,然後再按下右下角的**提交**按鈕送出工作給 Azure HDInsight 來執行。 90 | 91 | ```SQL 92 | DROP TABLE IF EXISTS DeviceReadings; 93 | 94 | CREATE EXTERNAL TABLE DeviceReadings ( 95 | type string, sensorDateTime string, deviceId string, roomNumber int, reading float 96 | ) 97 | ROW FORMAT DELIMITED FIELDS TERMINATED BY '\054' 98 | STORED AS TEXTFILE 99 | LOCATION 'wasb://data@儲存體帳戶名稱.blob.core.windows.net/input'; 100 | ``` 101 | 102 | 2. 按下提交後,可以在下方的工作階段中看到這個查詢工作執行的狀況: 103 | 104 | ![執行 Hive 查詢工作中](images/3-submitting-hive-query.png) 105 | 106 | 也可以利用上方的**工作歷程記錄**來觀看執行過的工作。 107 | 108 | 3. 當工作結束後,你可以執行一個新的查詢工作: 109 | 110 | ```SQL 111 | SELECT deviceId FROM DeviceReadings; 112 | ``` 113 | 114 | 再送出這個查詢工作確認是否正確建立了 **DeviceReadings** 的 Hive 資料表,如果有正確地列出來欄位的資料,就表示資料表已成功建立了。 115 | 116 | ![確認是否成功建立了 DeviceReadings 資料表](images/3-list-deviceids.png) 117 | 118 | 119 | ### 建立 AverageReadingByDeviceType 資料表 120 | 121 | 1. 如果成功建立了 DeviceReadings 的資料表,那接下來就可以根據 DeviceReadings 這個資料表來建立 AverageReadingByDeviceType 資料表,一樣要修改儲存體帳號的位置,而這個資料表的內容就會儲存在儲存體的 data/output 下。 122 | 123 | ```SQL 124 | DROP TABLE IF EXISTS AverageReadingByType; 125 | 126 | CREATE EXTERNAL TABLE AverageReadingByType (type string, reading float) 127 | row format delimited 128 | fields terminated by '\t' 129 | lines terminated by '\n' 130 | stored as textfile location 'wasb://data@.blob.core.windows.net/output/averageReadingByType'; 131 | 132 | 133 | INSERT INTO TABLE AverageReadingByType SELECT TYPE, avg(reading) 134 | FROM DeviceReadings 135 | GROUP BY TYPE; 136 | ``` 137 | 138 | 2. 如果這個查詢順利執行完成後,可以利用查詢主控台的檔案瀏覽器看一下它產生的檔案。 139 | 140 | ![Hive 資料表產生的檔案](images/3-hive-table-file-created.png) 141 | 142 | 143 | ### 建立 AverageReadingByMinute 資料表 144 | 145 | 1. 如同前述的方式,再執行下列查詢工作來產生 AverageReadingByMinute 資料表: 146 | 147 | ```SQL 148 | DROP TABLE IF EXISTS AverageReadingByMinute; 149 | 150 | CREATE EXTERNAL TABLE AverageReadingByMinute (type string, sensorDateTime string, roomNumber int, reading float) 151 | row format delimited 152 | fields terminated by '\t' 153 | lines terminated by '\n' 154 | stored as textfile location 'wasb://data@.blob.core.windows.net/output/averageReadingByMinute'; 155 | 156 | INSERT INTO TABLE AverageReadingByMinute SELECT TYPE, concat(substr(sensorDateTime, 1, 16), ":00.0000000Z"), roomNumber, avg(reading) 157 | FROM DeviceReadings 158 | WHERE roomNumber IS NOT NULL 159 | GROUP BY TYPE, concat(substr(sensorDateTime, 1, 16), ":00.0000000Z"), roomNumber; 160 | ``` 161 | 162 | ### 建立 MaximumReading 資料表 163 | 164 | 1. 執行下列 Hive 查詢工作: 165 | 166 | ```SQL 167 | DROP TABLE IF EXISTS MaximumReading; 168 | 169 | CREATE EXTERNAL TABLE MaximumReading (type string, sensorDateTime string, roomNumber int, maxReading float) 170 | row format delimited 171 | fields terminated by '\t' 172 | lines terminated by '\n' 173 | stored as textfile location 'wasb://data@.blob.core.windows.net/output/maximumReading'; 174 | 175 | INSERT INTO TABLE MaximumReading 176 | SELECT mr.type, min(mr.sensorDateTime), min(mr.roomNumber), mr.reading FROM ( 177 | SELECT a.type, a.sensorDateTime, a.roomNumber, a.reading from DeviceReadings a 178 | JOIN (SELECT type, max(reading) reading FROM DeviceReadings GROUP BY type ) b 179 | ON (a.type = b.type and a.reading = b.reading) 180 | ) mr 181 | GROUP BY mr.type, mr.reading; 182 | ``` 183 | 184 | ### 建立 MinumumReading 資料表 185 | 186 | 1. 執行下列 Hive 查詢工作: 187 | 188 | ```SQL 189 | DROP TABLE IF EXISTS MinimumReading; 190 | 191 | CREATE EXTERNAL TABLE MinimumReading (type string, sensorDateTime string, roomNumber int, maxReading float) 192 | row format delimited 193 | fields terminated by '\t' 194 | lines terminated by '\n' 195 | stored as textfile location 'wasb://data@.blob.core.windows.net/output/minimumReading'; 196 | 197 | INSERT INTO TABLE MinimumReading 198 | SELECT mr.type, min(mr.sensorDateTime), min(mr.roomNumber), mr.reading FROM ( 199 | SELECT a.type, a.sensorDateTime, a.roomNumber, a.reading from DeviceReadings a 200 | JOIN (SELECT type, min(reading) reading FROM DeviceReadings GROUP BY type ) b 201 | ON (a.type = b.type and a.reading = b.reading) 202 | ) mr 203 | GROUP BY mr.type, mr.reading; 204 | ``` 205 | 206 | # 4. 刪除 Hadoop 叢集 207 | 208 | 如果 lab 做完了,資料表也都儲存在 Azure Blob 儲存體中了,那 Azure HDInsight 的服務就可以先刪除,以免沒有使用到了還持續在提供服務,那帳單就會持續累積這些服務的使用費喔。 209 | 210 | # 5. 整合 Excel 中的 Power Query 做資料視覺化 211 | 212 | 在新版的 Excel 中可以安裝 Power Query 的插件來查詢並匯入許多不同資料來源的資料內容,其中也包含了 Hadoop 的 Hive 資料表,所以透過前面的步驟我們已經建立了 4 張 Hive 資料表,這裡就介紹如何將這些資料匯入 Excel 並且做出視覺化的呈現。 213 | 214 | 1. Excel 2016 已經內建 Power Query,若是 2010/2013 就另外下載安裝 [Power Query](https://www.microsoft.com/en-us/download/details.aspx?id=39379) 插件,選擇符合系統安裝的 Office 或 Excel 的語言及位元版本(32 位元或 64 位元)來安裝。 215 | 216 | 2. 開啟 Excel 並從一個空白表格開始,在上方的 **Data** (Excel 2016) 或 **Power Query** (Excel 2013) 的 Tab 下選擇 **New Query** » **From Azure** » **From Azure HDInsight**。 217 | 218 | ![從 Azure HDInsight 查詢資料](images/3-powerquery-azure-hdinsight.png) 219 | 220 | 3. 接著輸入儲存 Hive 資料表的儲存體帳號: 221 | 222 | ![從儲存體帳號](images/3-from-azure-hdinsight-storage.png) 223 | 224 | 然後輸入儲存體帳戶存取金鑰。 225 | 226 | ![輸入儲存體帳戶存取金鑰](images/3-storage-account-key.png) 227 | 228 | 4. 輸入完儲存體帳戶資料後,雙擊儲存 Hive 資料表的容器(如:data),接著就會開啟一個查詢編輯器。 229 | 230 | ![PowerQuery 查詢編輯器](images/3-query-selector-editor.png) 231 | 232 | 5. 選擇其中一個資料表,如:_averageReadingByMinute_,選擇下方的 _000000\_0_ 列,點擊左側 **Binary** 連結,查詢編輯器就會撈出這個資料表的資料。 233 | 234 | ![Hive 資料表的資料內容](images/3-query-data-from-hive-table.png) 235 | 236 | 237 | 6. 把欄位的名稱分別修改為 _DeviceType_、_ReadingDateTime_、_RoomNumber_ 及 _Reading_。 238 | 239 | ![修改好的欄位名稱](images/3-modified-column-name.png) 240 | 241 | 7. 接下來在查詢編輯器中按**關閉並讀取(Close & Load)**把資料載入 Excel 資料表中。 242 | 243 | ![將資料載入 Excel](images/3-load-data-into-excel.png) 244 | 245 | 8. 在 Excel 上方**插入(Insert)**的頁籤中,點擊 **Power View** 的按鈕。 246 | 247 | ![插入 Power View](images/3-insert-power-view.png) 248 | 249 | 9. 開啟 PowerView 之後,在右側的欄位面板中,將 **RoomNumber** 的下拉選單中改為 _Do Not Summarize_。 250 | 251 | ![](images/3-power-view-fields.png) 252 | 253 | 10. 在上面工具列中選擇 **Other Chart** » **Line**,就會將資料畫成折線圖。 254 | 255 | ![](images/3-power-view-line-chart.png) 256 | 257 | 258 | 11. 在右側的面板將 **DeviceType** 欄位中勾選 _energy_,就可以看到在不同時間、不同房門的能源變化趨勢。 259 | 260 | ![](images/3-line-chart-by-energy.png) -------------------------------------------------------------------------------- /HOL/HOL4-PowerBI.md: -------------------------------------------------------------------------------- 1 | # 4. 使用 Power BI 來顯示資料圖表 # 2 | 3 | 所需時間: **30 分鐘** 4 | 5 | -------------------------------------------------------------------------------- /HOL/HOL5-MachineLearning.md: -------------------------------------------------------------------------------- 1 | # Hands on Lab 5 - 使用 Azure 機器學習 # 2 | 3 | 所需時間: **30 分鐘** 4 | 5 | 事前準備: **擁有 Microsoft Azure 的訂閱帳戶並且能夠開通服務**。 6 | 7 | 8 | # 1. 建立 Azure 機器學習工作區 # 9 | 10 | 所需時間: **2 分鐘** 11 | 12 | 在 [Microsoft Azure 的管理後台](https://manage.windowsazure.com/),點擊左下角的_「+ 新增」_,選擇_「資料服務」_ » _「機器學習」_ ,選擇**快速建立**,然後填入**工作區名稱**、**擁有者**以及**儲存體帳戶**。儲存體帳戶在這裡是用來儲存機器學習時所需要或儲存後的資料。 13 | 14 | 目前 Azure 機器學習僅部署在美國中南部機房 15 | 16 | ![建立 Azure 機器學習工作區域](images/5-creating-azure-ml-workspace.png) 17 | 18 | 最後按下右下角的**建立 ML 工作區**完成建立。 19 | 20 | # 2. 進入 ML Studio # 21 | 22 | 所需時間: **2 分鐘** 23 | 24 | 建立好 Azure 機器學習工作區後,就可以在管理後台中,進入剛才建立的機器學習工作區,然後按照連結進入 ML Studio 中進行機器學習的操作。 25 | 26 | ![登入 ML Studio](images/5-signin-azure-ml-studio.png) 27 | 28 | 29 | # 3. 在 ML Studio 中建立實驗 # 30 | 31 | 所需時間: **20 分鐘** 32 | 33 | 1. 進入 ML Studio 後,按左下角的_「+ NEW」_,然後點擊 **Blank Experiment** 來建立一個全新的實驗。 34 | 35 | ![建立新的空白實驗](images/5-creating-azure-ml-experiment.png) 36 | 37 | 2. 進入實驗室的畫面後,在標題的部份改為_「汽車價格銷售預測模型」_,用來表示等一下做的實驗是什麼。 38 | 39 | ![全新的空白實驗室](images/5-starting-blank-experiment.png) 40 | 41 | 3. 從左側的面板中,於 **Saved Datasets** » **Samples** 裡拖拉出 **Automobile price data (RAW)** 的區塊到實驗室區域中。 42 | 43 | ![拉入汽車銷售資料](images/5-draging-a-dataset.png) 44 | 45 | 4. 在 Azure ML Studio 的實驗室中,你隨時可以在區域的輸出節點中按右鍵選擇 **Download** 或是 **Visualize** 來觀看資料的內容。 46 | 47 | ![按右鍵跳出選單](images/5-popup-menu-in-blocks.png) 48 | 49 | ![呈現資料](images/5-visualize-data.png) 50 | 51 | 5. 再從左側面板中,於 **Data Transformation** » **Manipulation** 中拖拉出 **Project Columns** 到實驗室區域中,並且把資料流接到這個區塊上,這樣就可以對資料進行一些操作。 52 | 53 | ![接上 Project Columns 的操作](images/5-attaching-project-columns.png) 54 | 55 | 6. 在選擇的焦點在 Project Columns 區塊上,然後按下右側面板的 **Launch column selector** ,在跳出的對話盒中選擇 _Begin With All columns_ 然後下方是 _Exclude column names normalized-losses_,這樣一來資料經過這個區域後就會移除 _normalized losses_ 這個欄位的資料。 56 | 57 | ![刪除欄位資料](images/5-projecting-columns-exclude.png) 58 | 59 | 7. 完成後,再從左側面板中的 **Data Transformation** » **Manipulation** 中拖拉出 **Cleaning Missing Data**,然後在右側面板中的 **Cleaning mode** 選擇 _Remove entire row_,再把資料流接起來,這樣便會移除資料中有欄位缺漏的資料。 60 | 61 | ![移除有缺漏欄位的資料](images/5-cleaning-missing-data.png) 62 | 63 | 8. 此時再拉出一個 **Project Columns** 的區塊,這次我們要把準備拿來訓練模型的欄位留下來,所以按下 **Launch column selector** 後,選擇 _Begin With No columns_ 然後 _Include column names make, body-style, wheel-base, engine-size, horsepower, peak-rpm, highway-mpg, price_ 並且再把資料流接起來。 64 | 65 | ![只留下必要的欄位](images/5-including-critical-columns.png) 66 | 67 | 68 | 9. 在準備開始訓練模型之前,我們要先把資料區分成兩部份,一部份用來做模型的訓練,而另一部份來驗證模型的準確度,所以從左側面板的 **Data Transformation** » **Sample and Split** 中拖拉出 **Split** 的區塊,接到資料流中,而這裡也可以利用右側的面板來決定資料要怎麼切割,在 **Fraction of rows ...** 的欄位中可以選擇 0 ~ 1 之間的數值,用來表示左側的輸出佔有多少比例(如:0.8 表示左側輸出 80% 的資料,右側則是 20%)。 69 | 70 | ![分割資料](images/5-spliting-dataset.png) 71 | 72 | 10. 拉下來要開始訓練模型,首先在左側面板中的 **Machine Learning** » **Train** 中拉出 **Train Model** 的區塊,並且把分割後的資料接上右側的輸入節點,由於我們建立出來的模型是要能預測價格,所以在 Train Model 中要選擇 _price_ 這個欄位。 73 | 74 | ![將資料輸入訓練模型中](images/5-train-model-by-dataset.png) 75 | 76 | 11. Train Model 的另一個輸入則是演算法,由於_汽車銷售價格預測模型_是一個**預測**的學習,所以這裡我們採用 _Regression_ 類的演算法來做訓練,從左側的面板中 **Machine Learning** » **Initialize Model** » **Regression** 中拖拉出 **Linear Regression** 的區塊,並接上 Train Model。 77 | 78 | ![將線性迴歸的演算法套入](images/5-using-linear-regression.png) 79 | 80 | 12. 訓練好的模型,我們要驗證一下這個模型的準確度,這裡可以從左側面板中 **Machine Learning** » **Score** 拉出 **Score Model**,並接上訓練好的模型以及分割用來做驗證的資料。Score Model 這裡就會使用訓練好的模型來預測輸入資料的價格。 81 | 82 | ![使用分數模型](images/5-using-scoring-model.png) 83 | 84 | 13. 最後,可以再使用 **Machine Learning** » **Evaluate** 中的 **Evaluate Model** 來分析及評估由 Score Model 做完的結果。 85 | 86 | ![使用驗證模型](images/5-using-evaluate-model.png) 87 | 88 | 14. 拖拉完畢,檢查這些區塊中是否有未完成的動作(看區塊中是否有紅色驚歎號),接著就能按下下方工作列的 **Run** 來實際執行一次機器學習的實驗。執行完成後,可以在 **Evaluate Model** 的輸出中按下 **Visualize** 來瀏覽這次實驗中訓練的模型準確度。 89 | 90 | ![評估後的結果](images/5-evaluation.png) 91 | 92 | 15. 到這裡已經完成了一次機器學習的操作,你可以試著替換不同的學習演算法(如將 _Linear Regression_ 換成其它的 Regression 演算法),或是分割資料時改變一些參數,重新再執行一次實驗,看看訓練出來的模型準確度如何。 93 | 94 | 95 | # 4. 將訓練模型發佈成 Web Service # 96 | 97 | 所需時間:**6 分鐘** 98 | 99 | 1. 在 ML Studio 的實驗室中,在實驗已經跑完的狀態下,從左側面板的 **Web Service** 中拉出 **Input** 及 **Output** 的區塊,然後將 **Input** 接在 _Score Model_ 的右側資料輸入的位置,然後 **Output** 接在 _Score Model_ 的輸出位置。 100 | 101 | ![加入 Web Service 的輸入及輸出](images/5-adding-webservice-input-output.png) 102 | 103 | 2. 接好 Web Service 的 Input 及 Output 之後,重新跑一次實驗,然後再按下下方工作列的 **PUBLISH WEB SERVICE** 按鈕將這個訓練好的模型做成 web service。 104 | 105 | ![發佈 Web Service](images/5-publish-web-service.png) 106 | 107 | 3. 發佈完成後就有一個 API 的說明頁面,包含了 **API Key** 以及測試 API 的小工具或 Excel Workbook。 108 | 109 | ![Web Service 的 API 頁面](images/5-published-web-service-page.png) 110 | 111 | 4. 按下 **Test** 按鈕,可以輸入一些測試資料來看看這個模型能預測出什麼價格,比方說可以輸入 toyota,hatchback,102.4,122,92,4200,32 看看它預測出來的價格離 11248 多遠。 112 | 113 | ![測試 API](images/5-test-web-service.png) 114 | 115 | 5. 按下 **REQUEST/RESPONSE** 的連結就會導向詳細的 API 說明頁面,包含呼叫的網址、參數以及範例程式碼,透過這一頁的說明,就可以很容易地將訓練好的模型透過 Web Service 的方式整合。 116 | 117 | ![API 說明頁面](images/5-api-help-page.png) -------------------------------------------------------------------------------- /HOL/Projects/EventHubReceiver/EventHubReceiver.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.22823.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventHubReceiver", "EventHubReceiver\EventHubReceiver.csproj", "{6170CB32-3643-48F3-B4F8-98B13B53947F}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {6170CB32-3643-48F3-B4F8-98B13B53947F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {6170CB32-3643-48F3-B4F8-98B13B53947F}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {6170CB32-3643-48F3-B4F8-98B13B53947F}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {6170CB32-3643-48F3-B4F8-98B13B53947F}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /HOL/Projects/EventHubReceiver/EventHubReceiver/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 14 | 16 | 17 | 18 | 20 | 22 | 24 | 26 | 28 | 29 | 30 | 32 | 34 | 36 | 38 | 40 | 42 | 44 | 45 | 46 | 47 | 48 | 49 | 51 | 52 | -------------------------------------------------------------------------------- /HOL/Projects/EventHubReceiver/EventHubReceiver/EventHubReceiver.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {6170CB32-3643-48F3-B4F8-98B13B53947F} 8 | Exe 9 | Properties 10 | EventHubReceiver 11 | EventHubReceiver 12 | v4.5.2 13 | 512 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | ..\packages\Microsoft.Data.Edm.5.2.0\lib\net40\Microsoft.Data.Edm.dll 38 | True 39 | 40 | 41 | ..\packages\Microsoft.Data.OData.5.2.0\lib\net40\Microsoft.Data.OData.dll 42 | True 43 | 44 | 45 | ..\packages\WindowsAzure.ServiceBus.2.6.4\lib\net40-full\Microsoft.ServiceBus.dll 46 | True 47 | 48 | 49 | ..\packages\Microsoft.Azure.ServiceBus.EventProcessorHost.1.1.3\lib\net45-full\Microsoft.ServiceBus.Messaging.EventProcessorHost.dll 50 | True 51 | 52 | 53 | ..\packages\Microsoft.WindowsAzure.ConfigurationManager.1.8.0.0\lib\net35-full\Microsoft.WindowsAzure.Configuration.dll 54 | True 55 | 56 | 57 | ..\packages\WindowsAzure.Storage.2.1.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll 58 | True 59 | 60 | 61 | ..\packages\Newtonsoft.Json.5.0.5\lib\net45\Newtonsoft.Json.dll 62 | True 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | ..\packages\System.Spatial.5.2.0\lib\net40\System.Spatial.dll 71 | True 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 97 | -------------------------------------------------------------------------------- /HOL/Projects/EventHubReceiver/EventHubReceiver/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.ServiceBus.Messaging; 3 | 4 | namespace EventHubReceiver 5 | { 6 | class Program 7 | { 8 | static void Main(string[] args) 9 | { 10 | string eventHubConnectionString = "讀取原則的連接字串"; 11 | string eventHubName = "事件中樞名稱"; 12 | string storageAccountName = "儲存體帳戶名稱"; 13 | string storageAccountKey = "儲存體存取金鑰"; 14 | string storageConnectionString = string.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}", 15 | storageAccountName, storageAccountKey); 16 | 17 | string eventProcessorHostName = Guid.NewGuid().ToString(); 18 | EventProcessorHost eventProcessorHost = new EventProcessorHost(eventProcessorHostName, eventHubName, EventHubConsumerGroup.DefaultGroupName, eventHubConnectionString, storageConnectionString); 19 | eventProcessorHost.RegisterEventProcessorAsync().Wait(); 20 | 21 | Console.WriteLine("Receiving.Press enter key to stop worker."); 22 | Console.ReadLine(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /HOL/Projects/EventHubReceiver/EventHubReceiver/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 組件的一般資訊是由下列的屬性集控制。 6 | // 變更這些屬性的值即可修改組件的相關 7 | // 資訊。 8 | [assembly: AssemblyTitle("EventHubReceiver")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("EventHubReceiver")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 將 ComVisible 設定為 false 會使得這個組件中的類型 18 | // 對 COM 元件而言為不可見。如果您需要從 COM 存取這個組件中 19 | // 的類型,請在該類型上將 ComVisible 屬性設定為 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID 23 | [assembly: Guid("6170cb32-3643-48f3-b4f8-98b13b53947f")] 24 | 25 | // 組件的版本資訊是由下列四項值構成: 26 | // 27 | // 主要版本 28 | // 次要版本 29 | // 組建編號 30 | // 修訂編號 31 | // 32 | // 您可以指定所有的值,也可以依照以下的方式,使用 '*' 將組建和修訂編號 33 | // 指定為預設值: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /HOL/Projects/EventHubReceiver/EventHubReceiver/ReceiveProcessor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Microsoft.ServiceBus.Messaging; 7 | 8 | namespace EventHubReceiver 9 | { 10 | class ReceiveProcessor : IEventProcessor 11 | { 12 | Stopwatch checkpointStopWatch; 13 | 14 | async Task IEventProcessor.CloseAsync(PartitionContext context, CloseReason reason) 15 | { 16 | Console.WriteLine(string.Format("Processor Shuting Down.Partition '{0}', Reason:'{1}'.", context.Lease.PartitionId, reason.ToString())); 17 | if (reason == CloseReason.Shutdown) 18 | { 19 | await context.CheckpointAsync(); 20 | } 21 | } 22 | 23 | Task IEventProcessor.OpenAsync(PartitionContext context) 24 | { 25 | Console.WriteLine(string.Format("SimpleEventProcessor initialize.Partition:'{0}', Offset:'{1}'", context.Lease.PartitionId, context.Lease.Offset)); 26 | this.checkpointStopWatch = new Stopwatch(); 27 | this.checkpointStopWatch.Start(); 28 | return Task.FromResult(null); 29 | } 30 | 31 | async Task IEventProcessor.ProcessEventsAsync(PartitionContext context, IEnumerable messages) 32 | { 33 | foreach (EventData eventData in messages) 34 | { 35 | string data = Encoding.UTF8.GetString(eventData.GetBytes()); 36 | 37 | Console.WriteLine(string.Format("Message received.Partition:'{0}', Data:'{1}'", 38 | context.Lease.PartitionId, data)); 39 | } 40 | 41 | //Call checkpoint every 5 minutes, so that worker can resume processing from the 5 minutes back if it restarts. 42 | if (this.checkpointStopWatch.Elapsed > TimeSpan.FromMinutes(5)) 43 | { 44 | await context.CheckpointAsync(); 45 | this.checkpointStopWatch.Restart(); 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /HOL/Projects/EventHubReceiver/EventHubReceiver/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /HOL/Projects/EventHubSender/EventHubSender.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.22823.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventHubSender", "EventHubSender\EventHubSender.csproj", "{871CA3DE-66F1-4ECA-9E93-1E7FF43FADCD}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {871CA3DE-66F1-4ECA-9E93-1E7FF43FADCD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {871CA3DE-66F1-4ECA-9E93-1E7FF43FADCD}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {871CA3DE-66F1-4ECA-9E93-1E7FF43FADCD}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {871CA3DE-66F1-4ECA-9E93-1E7FF43FADCD}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /HOL/Projects/EventHubSender/EventHubSender/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 14 | 16 | 17 | 18 | 20 | 22 | 24 | 26 | 28 | 29 | 30 | 32 | 34 | 36 | 38 | 40 | 42 | 44 | 45 | 46 | 47 | 48 | 49 | 51 | 52 | -------------------------------------------------------------------------------- /HOL/Projects/EventHubSender/EventHubSender/EventHubSender.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {871CA3DE-66F1-4ECA-9E93-1E7FF43FADCD} 8 | Exe 9 | Properties 10 | EventHubSender 11 | EventHubSender 12 | v4.5 13 | 512 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | ..\packages\WindowsAzure.ServiceBus.2.6.7\lib\net40-full\Microsoft.ServiceBus.dll 37 | True 38 | 39 | 40 | ..\packages\Microsoft.WindowsAzure.ConfigurationManager.1.7.0.0\lib\net35-full\Microsoft.WindowsAzure.Configuration.dll 41 | True 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 70 | -------------------------------------------------------------------------------- /HOL/Projects/EventHubSender/EventHubSender/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.Threading.Tasks; 4 | using Microsoft.ServiceBus.Messaging; 5 | 6 | namespace EventHubSender 7 | { 8 | class Program 9 | { 10 | static string eventHubName = "{YOUR_EVENT_HUB_NAME}"; 11 | static string connectionString = "{YOUR_SENDER_CONNECTION_STRING}"; 12 | 13 | static void Main(string[] args) 14 | { 15 | Console.WriteLine("按下 Ctrl-C 來停止傳送訊息"); 16 | Console.WriteLine("按下 Enter 鍵後開始傳送訊息"); 17 | Console.ReadLine(); 18 | SendingRandomMessages().Wait(); 19 | } 20 | 21 | static async Task SendingRandomMessages() 22 | { 23 | var eventHubClient = EventHubClient.CreateFromConnectionString(connectionString, eventHubName); 24 | 25 | var random = new Random(); 26 | 27 | while (true) 28 | { 29 | var guid = Guid.NewGuid().ToString(); 30 | var time = DateTime.Now.ToString(); 31 | var thermal = random.Next(195, 265) / 10.0 ; 32 | var humidity = random.Next(58, 82); 33 | var message = "{\"id\":\""+guid+"\", \"thermal\":"+thermal+", \"humidity\":"+humidity+", \"time\":\""+time+"\"}"; 34 | 35 | try 36 | { 37 | Console.WriteLine("{0} > 傳送訊息:{1}", time, message); 38 | await eventHubClient.SendAsync(new EventData(Encoding.UTF8.GetBytes(message))); 39 | } 40 | catch (Exception exception) 41 | { 42 | Console.ForegroundColor = ConsoleColor.Red; 43 | Console.WriteLine("{0} > 例外狀況:{1}", time, exception.Message); 44 | Console.ResetColor(); 45 | } 46 | 47 | await Task.Delay(200); 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /HOL/Projects/EventHubSender/EventHubSender/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 組件的一般資訊是由下列的屬性集控制。 6 | // 變更這些屬性的值即可修改組件的相關 7 | // 資訊。 8 | [assembly: AssemblyTitle("EventHubSender")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("EventHubSender")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 將 ComVisible 設定為 false 會使得這個組件中的類型 18 | // 對 COM 元件而言為不可見。如果您需要從 COM 存取這個組件中 19 | // 的類型,請在該類型上將 ComVisible 屬性設定為 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID 23 | [assembly: Guid("871ca3de-66f1-4eca-9e93-1e7ff43fadcd")] 24 | 25 | // 組件的版本資訊是由下列四項值構成: 26 | // 27 | // 主要版本 28 | // 次要版本 29 | // 組建編號 30 | // 修訂編號 31 | // 32 | // 您可以指定所有的值,也可以依照以下的方式,使用 '*' 將組建和修訂編號 33 | // 指定為預設值: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /HOL/Projects/EventHubSender/EventHubSender/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /HOL/images/0-signup-microsoft-azure-subscription.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/0-signup-microsoft-azure-subscription.png -------------------------------------------------------------------------------- /HOL/images/1-add-receiveprocessor-class.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/1-add-receiveprocessor-class.png -------------------------------------------------------------------------------- /HOL/images/1-configure-event-hub-connection-string.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/1-configure-event-hub-connection-string.png -------------------------------------------------------------------------------- /HOL/images/1-create-event-hub-receiver-project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/1-create-event-hub-receiver-project.png -------------------------------------------------------------------------------- /HOL/images/1-create-event-hubs-custom-step1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/1-create-event-hubs-custom-step1.png -------------------------------------------------------------------------------- /HOL/images/1-create-event-hubs-custom-step2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/1-create-event-hubs-custom-step2.png -------------------------------------------------------------------------------- /HOL/images/1-create-event-hubs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/1-create-event-hubs.png -------------------------------------------------------------------------------- /HOL/images/1-create-eventhub-sender-project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/1-create-eventhub-sender-project.png -------------------------------------------------------------------------------- /HOL/images/1-event-hubs-in-service-bus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/1-event-hubs-in-service-bus.png -------------------------------------------------------------------------------- /HOL/images/1-event-hubs-partitions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/1-event-hubs-partitions.png -------------------------------------------------------------------------------- /HOL/images/1-event-hubs-primary-key-for-policies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/1-event-hubs-primary-key-for-policies.png -------------------------------------------------------------------------------- /HOL/images/1-event-hubs-settings-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/1-event-hubs-settings-page.png -------------------------------------------------------------------------------- /HOL/images/1-install-azure-service-bus-event-hub-event-processor-host.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/1-install-azure-service-bus-event-hub-event-processor-host.png -------------------------------------------------------------------------------- /HOL/images/1-install-azure-service-bus-sdk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/1-install-azure-service-bus-sdk.png -------------------------------------------------------------------------------- /HOL/images/1-manage-nuget-pkg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/1-manage-nuget-pkg.png -------------------------------------------------------------------------------- /HOL/images/1-navigate-created-event-hubs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/1-navigate-created-event-hubs.png -------------------------------------------------------------------------------- /HOL/images/1-send-recv-events.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/1-send-recv-events.png -------------------------------------------------------------------------------- /HOL/images/1-setting-event-hubs-policies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/1-setting-event-hubs-policies.png -------------------------------------------------------------------------------- /HOL/images/2-adding-stream-input.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/2-adding-stream-input.png -------------------------------------------------------------------------------- /HOL/images/2-adding-stream-output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/2-adding-stream-output.png -------------------------------------------------------------------------------- /HOL/images/2-configuring-stream-data-type.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/2-configuring-stream-data-type.png -------------------------------------------------------------------------------- /HOL/images/2-creating-stream-analytics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/2-creating-stream-analytics.png -------------------------------------------------------------------------------- /HOL/images/2-intro-stream-analytics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/2-intro-stream-analytics.png -------------------------------------------------------------------------------- /HOL/images/2-output-to-blob-storage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/2-output-to-blob-storage.png -------------------------------------------------------------------------------- /HOL/images/2-selecting-event-hub.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/2-selecting-event-hub.png -------------------------------------------------------------------------------- /HOL/images/2-selecting-stream-input-source.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/2-selecting-stream-input-source.png -------------------------------------------------------------------------------- /HOL/images/2-selecting-stream-input.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/2-selecting-stream-input.png -------------------------------------------------------------------------------- /HOL/images/2-selecting-stream-output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/2-selecting-stream-output.png -------------------------------------------------------------------------------- /HOL/images/3-creating-azure-hdinsight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/3-creating-azure-hdinsight.png -------------------------------------------------------------------------------- /HOL/images/3-from-azure-hdinsight-storage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/3-from-azure-hdinsight-storage.png -------------------------------------------------------------------------------- /HOL/images/3-hadoop-core.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/3-hadoop-core.png -------------------------------------------------------------------------------- /HOL/images/3-hadoop-on-windows-server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/3-hadoop-on-windows-server.png -------------------------------------------------------------------------------- /HOL/images/3-hdinsight-hive-editor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/3-hdinsight-hive-editor.png -------------------------------------------------------------------------------- /HOL/images/3-hdinsight-query-console.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/3-hdinsight-query-console.png -------------------------------------------------------------------------------- /HOL/images/3-hive-table-file-created.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/3-hive-table-file-created.png -------------------------------------------------------------------------------- /HOL/images/3-insert-power-view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/3-insert-power-view.png -------------------------------------------------------------------------------- /HOL/images/3-intro-azure-hdinsight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/3-intro-azure-hdinsight.png -------------------------------------------------------------------------------- /HOL/images/3-line-chart-by-energy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/3-line-chart-by-energy.png -------------------------------------------------------------------------------- /HOL/images/3-list-deviceids.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/3-list-deviceids.png -------------------------------------------------------------------------------- /HOL/images/3-load-data-into-excel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/3-load-data-into-excel.png -------------------------------------------------------------------------------- /HOL/images/3-modified-column-name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/3-modified-column-name.png -------------------------------------------------------------------------------- /HOL/images/3-power-view-fields.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/3-power-view-fields.png -------------------------------------------------------------------------------- /HOL/images/3-power-view-line-chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/3-power-view-line-chart.png -------------------------------------------------------------------------------- /HOL/images/3-powerquery-azure-hdinsight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/3-powerquery-azure-hdinsight.png -------------------------------------------------------------------------------- /HOL/images/3-query-console-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/3-query-console-button.png -------------------------------------------------------------------------------- /HOL/images/3-query-data-from-hive-table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/3-query-data-from-hive-table.png -------------------------------------------------------------------------------- /HOL/images/3-query-selector-editor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/3-query-selector-editor.png -------------------------------------------------------------------------------- /HOL/images/3-storage-account-key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/3-storage-account-key.png -------------------------------------------------------------------------------- /HOL/images/3-submitting-hive-query.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/3-submitting-hive-query.png -------------------------------------------------------------------------------- /HOL/images/5-adding-webservice-input-output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/5-adding-webservice-input-output.png -------------------------------------------------------------------------------- /HOL/images/5-api-help-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/5-api-help-page.png -------------------------------------------------------------------------------- /HOL/images/5-attaching-project-columns.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/5-attaching-project-columns.png -------------------------------------------------------------------------------- /HOL/images/5-cleaning-missing-data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/5-cleaning-missing-data.png -------------------------------------------------------------------------------- /HOL/images/5-creating-azure-ml-experiment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/5-creating-azure-ml-experiment.png -------------------------------------------------------------------------------- /HOL/images/5-creating-azure-ml-workspace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/5-creating-azure-ml-workspace.png -------------------------------------------------------------------------------- /HOL/images/5-draging-a-dataset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/5-draging-a-dataset.png -------------------------------------------------------------------------------- /HOL/images/5-evaluation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/5-evaluation.png -------------------------------------------------------------------------------- /HOL/images/5-including-critical-columns.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/5-including-critical-columns.png -------------------------------------------------------------------------------- /HOL/images/5-popup-menu-in-blocks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/5-popup-menu-in-blocks.png -------------------------------------------------------------------------------- /HOL/images/5-projecting-columns-exclude.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/5-projecting-columns-exclude.png -------------------------------------------------------------------------------- /HOL/images/5-publish-web-service.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/5-publish-web-service.png -------------------------------------------------------------------------------- /HOL/images/5-published-web-service-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/5-published-web-service-page.png -------------------------------------------------------------------------------- /HOL/images/5-signin-azure-ml-studio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/5-signin-azure-ml-studio.png -------------------------------------------------------------------------------- /HOL/images/5-spliting-dataset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/5-spliting-dataset.png -------------------------------------------------------------------------------- /HOL/images/5-starting-blank-experiment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/5-starting-blank-experiment.png -------------------------------------------------------------------------------- /HOL/images/5-test-web-service.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/5-test-web-service.png -------------------------------------------------------------------------------- /HOL/images/5-train-model-by-dataset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/5-train-model-by-dataset.png -------------------------------------------------------------------------------- /HOL/images/5-using-evaluate-model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/5-using-evaluate-model.png -------------------------------------------------------------------------------- /HOL/images/5-using-linear-regression.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/5-using-linear-regression.png -------------------------------------------------------------------------------- /HOL/images/5-using-scoring-model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/5-using-scoring-model.png -------------------------------------------------------------------------------- /HOL/images/5-visualize-data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/HOL/images/5-visualize-data.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2015 Microsoft Taiwan DX 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /Presentation/1. Introduction/Introduction.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/Presentation/1. Introduction/Introduction.pptx -------------------------------------------------------------------------------- /Presentation/2. Data Streaming/Data Streaming.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/Presentation/2. Data Streaming/Data Streaming.pptx -------------------------------------------------------------------------------- /Presentation/3. HDInsight/Hadoop in Azure.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/Presentation/3. HDInsight/Hadoop in Azure.pptx -------------------------------------------------------------------------------- /Presentation/5. Intelligence/Azure Machine Learning.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericsk/AzureIoTCamp/ed7de6e9bb53025331fc9dab3eeda48acd6c0236/Presentation/5. Intelligence/Azure Machine Learning.pptx -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Azure IoT 動手操作實驗室 2 | 3 | Microsoft Azure IoT Suite 的動手操作營的教材及投影片,問題建議可至 [MSDN 論壇 - Microsoft Azure PaaS 服務](https://social.msdn.microsoft.com/Forums/zh-TW/home?forum=2199) 發問交流。 4 | 5 | 議程 | 時間 | 教材 6 | ---- | ---- | ---- 7 | Azure IoT 服務簡介 | 10 分鐘 | [投影片](Presentation/1. Introduction/Introduction.pptx) 8 | 準備工作 | 30 分鐘 | [操作手冊](HOL/HOL0-Prepare.md) 9 | Azure Event Hubs 及 Stream Analytics 介紹 | 60 分鐘 | [投影片](Presentation/2. Data Streaming/Data Streaming.pptx) | [操作手冊](HOL/HOL1-EventHubs.md) 10 | Azure Event Hubs 動手操作 | 30 分鐘 | [操作手冊](HOL/HOL1-EventHubs.md) 11 | Azure Stream Analytics 動手操作 | 30 分鐘 | [操作手冊](HOL/HOL2-StreamAnalytics.md) 12 | Azure HDInsight 簡介 | 60 分鐘 | [投影片](Presentation/3. HDInsight/Hadoop in Azure.pptx) 13 | Azure HDInsight 動手操作 | 60 分鐘 | [操作手冊](HOL/HOL3-HDInsight.md) 14 | Microsoft Power BI 簡介 | 30 分鐘 | 投影片 (coming soon) 15 | Microsoft Power BI 動手操作 | 30 分鐘 | 操作手冊 (coming soon) 16 | Azure 機器學習簡介 | 30 分鐘 | [投影片](Presentation/5. Intelligence/Azure Machine Learning.pptx) 17 | Azure 機器學習動手操作 | 30 分鐘 | [操作手冊](HOL/HOL5-MachineLearning.md) --------------------------------------------------------------------------------