共用方式為


使用 C# 從 Azure Time Series Insights Gen1 環境查詢資料

備註

時間序列深入解析服務將於 2024 年 7 月 7 日淘汰。 請考慮儘快將現有的環境移轉至替代解決方案。 如需淘汰和移轉的詳細資訊,請瀏覽我們的

謹慎

這是一篇 Gen1 文章。

此 C# 範例示範如何使用 Gen1 查詢 API,從 Azure Time Series Insights Gen1 環境查詢資料。

提示

https://github.com/Azure-Samples/Azure-Time-Series-Insights檢視 Gen1 C# 程式代碼範例。

總結

下列範例程式代碼示範下列功能:

必要條件和設定

在編譯和執行範例程序代碼之前,請先完成下列步驟:

  1. 布建 Gen1 Azure 時間序列深入解析 環境。
  2. 認證和授權中所述,配置 Microsoft Entra ID 的 Azure Time Series Insights 環境。
  3. 安裝必要的專案依賴性。
  4. 將下列範例程式代碼中的每個 #DUMMY# 取代為適當的環境識別碼。
  5. 在 Visual Studio 內執行程式代碼。

專案相依性

建議您使用最新版的 Visual Studio:

範例程式代碼有兩個必要的相依性:

在 Visual Studio 2019 中,選取 [建置>建置方案] 選項以下載套件。

或者,使用 NuGet 2.12+新增套件:

  • dotnet add package Newtonsoft.Json --version 9.0.1
  • dotnet add package Microsoft.IdentityModel.Clients.ActiveDirectory --version 3.13.9

C# 範例程序代碼

請參閱 Azure 時間序列深入解析] 存放庫,以存取 C# 範例程序代碼。

後續步驟

  • 若要深入瞭解查詢,請閱讀 查詢 API 參考

  • 瞭解如何使用用戶端 SDK 將 JavaScript 應用程式連線到 Time Series Insights 。 Azure-Samples/Azure-Time-Series-Insights/gen1-sample/csharp-tsi-gen1-sample/Program.cs