你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Application Insights 密钥

适用于:SDK v4

Azure Application Insights 在 Microsoft Azure 资源中显示有关应用程序的数据。 如要向机器人添加遥测,需要 Azure 订阅以及为机器人创建的 Application Insights 资源。 从此资源可以获得用于配置机器人的三个密钥:

  1. 检测密钥
  2. 应用程序 ID
  3. API 密钥

本主题将演示如何创建这些 Application Insights 密钥。

注意

在机器人创建或注册过程中,可以选择启用或禁用 Application Insights。 如果已启用它 ,则机器人已拥有它所需的所有必需的 Application Insights 密钥。 但是,如果已将其禁用 ,则可以按照本主题中的说明操作,以帮助你手动创建这些密钥。

检测密钥

如要获取检测密钥,请执行以下操作:

  1. Azure 门户中的“监视”部分下,创建一个新的 Application Insights 资源(或使用现有资源)。

    Portal screen capture of Application Insights listing.

  2. 从 Application Insights 资源列表中,单击创建的 Application Insight 资源。

  3. 单击“概览”。

  4. 展开“概要” 块并找到“检测密钥” 。

    Portal screen capture of Overview

    Portal screen capture of the Instrumentation key

  5. 复制检测密钥并将其粘贴到机器人设置的“Application Insights 检测密钥” 字段中。

应用程序 ID

如要获取应用程序 ID,请执行以下操作:

  1. 在 Application Insights 资源中,单击“API 访问权限” 。

  2. 复制应用程序 ID 并将其粘贴到机器人设置的“Application Insights 应用程序 ID” 字段中。

    Portal screen capture of the Application ID

API 密钥

如要获取 API 密钥,请执行以下操作:

  1. 在 Application Insights 资源中,单击“API 访问权限” 。

  2. 单击“创建 API 密钥” 。

  3. 输入简短说明,选中“读取遥测”选项,然后单击“生成密钥”按钮。

    Portal screen capture of the Application ID and API Key

    警告

    复制此 API 密钥并保存,因为此密钥永远不会再次向你显示。 如果丢失此密钥,则需要创建一个新密钥。

  4. 将 API 密钥复制到机器人设置的“Application Insights API 密钥” 字段。

其他信息

有关如何将这些字段连接到机器人设置的详细信息,请参阅启用分析