Components - Create Or Update

创建 Application Insights 组件(或更新)。 注意:不能在 Put作中为 InstrumentationKey 和 AppId 指定其他值。

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}?api-version=2015-05-01

URI 参数

名称 必需 类型 说明
resourceGroupName
path True

string

minLength: 1
maxLength: 90

资源组的名称。 名称不区分大小写。

resourceName
path True

string

Application Insights 组件资源的名称。

subscriptionId
path True

string

minLength: 1

目标订阅的 ID。

api-version
query True

string

minLength: 1

用于此作的 API 版本。

请求正文

名称 必需 类型 说明
kind True

string

此组件引用的应用程序类型,用于自定义 UI。 此值是任意多边形字符串,值通常应为以下值之一:Web、ios、其他、存储、java、手机。

___location True

string

资源位置

properties.Application_Type True

ApplicationType

正在监视的应用程序的类型。

properties.DisableIpMasking

boolean

禁用 IP 掩码。

properties.Flow_Type

FlowType

Application Insights 系统用于确定此组件创建的流类型。 这是在通过 REST API 创建/更新组件时设置为“Bluefield”。

properties.HockeyAppId

string

将新应用程序添加到 HockeyApp 时创建的唯一应用程序 ID,用于与 HockeyApp 通信。

properties.ImmediatePurgeDataOn30Days

boolean

在 30 天后立即清除数据。

properties.IngestionMode

IngestionMode

指示引入的流。

properties.Request_Source

RequestSource

介绍创建此 Application Insights 组件的工具。 使用此 API 的客户应将此设置为默认的“rest”。

properties.RetentionInDays

integer

保留期(以天为单位)。

properties.SamplingPercentage

number (double)

正在为 Application Insights 遥测采样的应用程序生成的数据的百分比。

tags

object

资源标记

响应

名称 类型 说明
200 OK

ApplicationInsightsComponent

创建或更新 Application Insights 组件时成功的请求。 返回更新的组件。

安全性

azure_auth

Azure Active Directory OAuth2 Flow。

类型: oauth2
流向: implicit
授权 URL: https://login.microsoftonline.com/common/oauth2/authorize

作用域

名称 说明
user_impersonation 模拟用户帐户

示例

ComponentCreate
ComponentUpdate

ComponentCreate

示例请求

PUT https://management.azure.com/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component?api-version=2015-05-01

{
  "___location": "South Central US",
  "kind": "web",
  "properties": {
    "Application_Type": "web",
    "Flow_Type": "Bluefield",
    "Request_Source": "rest"
  }
}

示例响应

{
  "id": "/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component",
  "name": "my-component",
  "type": "Microsoft.Insights/components",
  "___location": "South Central US",
  "tags": "",
  "kind": "web",
  "properties": {
    "ApplicationId": "my-component",
    "AppId": "887f4bfd-b5fd-40d7-9fc3-123456789abc",
    "Application_Type": "web",
    "Flow_Type": "Bluefield",
    "Request_Source": "rest",
    "InstrumentationKey": "bc095013-3cf2-45ac-ab47-123456789abc",
    "CreationDate": "2017-01-24T01:05:38.5934061+00:00",
    "TenantId": "f438d567-7177-4fe1-a5e3-123456789abc",
    "HockeyAppId": "",
    "HockeyAppToken": "",
    "provisioningState": "Succeeded",
    "SamplingPercentage": 100,
    "RetentionInDays": 90,
    "ConnectionString": "InstrumentationKey=bc095013-3cf2-45ac-ab47-123456789abc",
    "DisableIpMasking": false,
    "ImmediatePurgeDataOn30Days": false,
    "IngestionMode": "ApplicationInsights"
  }
}

ComponentUpdate

示例请求

PUT https://management.azure.com/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component?api-version=2015-05-01

{
  "___location": "South Central US",
  "kind": "web",
  "tags": {
    "ApplicationGatewayType": "Internal-Only",
    "BillingEntity": "Self"
  }
}

示例响应

{
  "id": "/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component",
  "name": "my-component",
  "type": "Microsoft.Insights/components",
  "___location": "South Central US",
  "tags": {
    "ApplicationGatewayType": "Internal-Only",
    "BillingEntity": "Self"
  },
  "kind": "web",
  "properties": {
    "ApplicationId": "my-component",
    "AppId": "887f4bfd-b5fd-40d7-9fc3-123456789abc",
    "Application_Type": "web",
    "Flow_Type": "Bluefield",
    "Request_Source": "rest",
    "InstrumentationKey": "bc095013-3cf2-45ac-ab47-123456789abc",
    "CreationDate": "2017-01-24T01:05:38.5934061+00:00",
    "TenantId": "f438d567-7177-4fe1-a5e3-123456789abc",
    "HockeyAppId": "",
    "HockeyAppToken": "",
    "provisioningState": "Succeeded",
    "SamplingPercentage": 100,
    "RetentionInDays": 90,
    "ConnectionString": "InstrumentationKey=bc095013-3cf2-45ac-ab47-123456789abc",
    "DisableIpMasking": false,
    "ImmediatePurgeDataOn30Days": false,
    "IngestionMode": "ApplicationInsights"
  }
}

定义

名称 说明
ApplicationInsightsComponent

Application Insights 组件定义。

ApplicationType

正在监视的应用程序的类型。

FlowType

Application Insights 系统用于确定此组件创建的流类型。 这是在通过 REST API 创建/更新组件时设置为“Bluefield”。

IngestionMode

指示引入的流。

PrivateLinkScopedResource

专用链接范围资源参考。

RequestSource

介绍创建此 Application Insights 组件的工具。 使用此 API 的客户应将此设置为默认的“rest”。

ApplicationInsightsComponent

Application Insights 组件定义。

名称 类型 默认值 说明
id

string

Azure 资源 ID

kind

string

此组件引用的应用程序类型,用于自定义 UI。 此值是任意多边形字符串,值通常应为以下值之一:Web、ios、其他、存储、java、手机。

___location

string

资源位置

name

string

Azure 资源名称

properties.AppId

string

应用程序的 Application Insights 唯一 ID。

properties.ApplicationId

string

应用程序的唯一 ID。 此字段镜像“名称”字段,无法更改。

properties.Application_Type

ApplicationType

web

正在监视的应用程序的类型。

properties.ConnectionString

string

Application Insights 组件连接字符串。

properties.CreationDate

string (date-time)

Application Insights 组件的创建日期(采用 ISO 8601 格式)。

properties.DisableIpMasking

boolean

禁用 IP 掩码。

properties.Flow_Type

FlowType

Bluefield

Application Insights 系统用于确定此组件创建的流类型。 这是在通过 REST API 创建/更新组件时设置为“Bluefield”。

properties.HockeyAppId

string

将新应用程序添加到 HockeyApp 时创建的唯一应用程序 ID,用于与 HockeyApp 通信。

properties.HockeyAppToken

string

用于对 Application Insights 和 HockeyApp 之间的通信进行身份验证的令牌。

properties.ImmediatePurgeDataOn30Days

boolean

在 30 天后立即清除数据。

properties.IngestionMode

IngestionMode

ApplicationInsights

指示引入的流。

properties.InstrumentationKey

string

Application Insights 检测密钥。 应用程序可用于标识发送到 Azure Application Insights 的所有遥测的目标的只读值。 在构造每个新的 Application Insights 组件时,将提供此值。

properties.PrivateLinkScopedResources

PrivateLinkScopedResource[]

链接的专用链接范围资源列表。

properties.Request_Source

RequestSource

rest

介绍创建此 Application Insights 组件的工具。 使用此 API 的客户应将此设置为默认的“rest”。

properties.RetentionInDays

integer

90

保留期(以天为单位)。

properties.SamplingPercentage

number (double)

正在为 Application Insights 遥测采样的应用程序生成的数据的百分比。

properties.TenantId

string

Azure 租户 ID。

properties.provisioningState

string

此组件的当前状态:是否已在已定义的资源组中预配。 用户无法更改此值,但可以从中读取此值。 值将包括 Succeeded、Deploying、Canceled 和 Failed。

tags

object

资源标记

type

string

Azure 资源类型

ApplicationType

正在监视的应用程序的类型。

说明
other
web

FlowType

Application Insights 系统用于确定此组件创建的流类型。 这是在通过 REST API 创建/更新组件时设置为“Bluefield”。

说明
Bluefield

IngestionMode

指示引入的流。

说明
ApplicationInsights
ApplicationInsightsWithDiagnosticSettings
LogAnalytics

PrivateLinkScopedResource

专用链接范围资源参考。

名称 类型 说明
ResourceId

string

专用链接范围资源的完整资源 ID。

ScopeId

string

专用链接范围唯一标识符。

RequestSource

介绍创建此 Application Insights 组件的工具。 使用此 API 的客户应将此设置为默认的“rest”。

说明
rest