使用 Application Insights 來分析即時 Azure Functions 應用程式

在本文中,您將使用 Azure 入口網站執行下列動作:

  • 檢視 Functions 應用程式的目前應用程式設定。
  • 新增兩個新的應用程式設定,以在 Functions 應用程式上啟用 Profiler。
  • 瀏覽至 Functions 應用程式的 Profiler 以檢視資料。

注意

您可以為 [App Service] 方案上的 Azure Functions 應用程式啟用 Application Insights Profiler。

必要條件

用於啟用 Profiler 的應用程式設定

應用程式設定
APPINSIGHTS_PROFILERFEATURE_VERSION 1.0.0
DiagnosticServices_EXTENSION_VERSION ~3
APPINSIGHTS_INSTRUMENTATIONKEY 來自您 App Insights 資源的唯一值。

將應用程式設定新增至 Azure Functions 應用程式

在 Azure 入口網站中從 Functions 應用程式概觀頁面:

  1. 在 [設定] 底下,選取 [設定]

    Screenshot of selecting Configuration from under the Settings section of the left side menu.

  2. 在 [應用程式設定] 索引標籤中,確認 APPINSIGHTS_INSTRUMENTATIONKEY 設定已包含在設定清單中。

    Screenshot showing the App Insights Instrumentation Key setting in the list.

  3. 選取 [新增應用程式設定]

    Screenshot outlining the new application setting button.

  4. 上表複製 [應用程式設定] 及其 [值],並貼到對應的欄位中。

    Screenshot adding the app insights profiler feature version setting.

    Screenshot adding the diagnostic services extension version setting.

    目前將 [部署位置設定] 保留空白。

  5. 按一下 [確定]

  6. 按一下頂端功能表中的 [儲存],然後按一下 [繼續]

    Screenshot outlining the save button in the top menu of the configuration pane.

    Screenshot outlining the continue button in the dialog after saving.

應用程式設定現在顯示在資料表中:

Screenshot showing the two new app settings in the table on the configuration pane.

注意

您也可以使用下列項目來啟用 Profiler:

後續步驟

了解如何...