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

Microsoft.Insights webtests

Bicep 资源定义

Webtests 资源类型可以通过针对以下操作进行部署:

有关每个 API 版本中更改的属性的列表,请参阅 更改日志

资源格式

若要创建 Microsoft.Insights/webtests 资源,请将以下 Bicep 添加到模板。

resource symbolicname 'Microsoft.Insights/webtests@2022-06-15' = {
  name: 'string'
  location: 'string'
  tags: {
    tagName1: 'tagValue1'
    tagName2: 'tagValue2'
  }
  kind: 'string'
  properties: {
    Configuration: {
      WebTest: 'string'
    }
    Description: 'string'
    Enabled: bool
    Frequency: int
    Kind: 'string'
    Locations: [
      {
        Id: 'string'
      }
    ]
    Name: 'string'
    Request: {
      FollowRedirects: bool
      Headers: [
        {
          key: 'string'
          value: 'string'
        }
      ]
      HttpVerb: 'string'
      ParseDependentRequests: bool
      RequestBody: 'string'
      RequestUrl: 'string'
    }
    RetryEnabled: bool
    SyntheticMonitorId: 'string'
    Timeout: int
    ValidationRules: {
      ContentValidation: {
        ContentMatch: 'string'
        IgnoreCase: bool
        PassIfTextFound: bool
      }
      ExpectedHttpStatusCode: int
      IgnoreHttpStatusCode: bool
      SSLCertRemainingLifetimeCheck: int
      SSLCheck: bool
    }
  }
}

属性值

webtests

名称 说明
name 资源名称 字符串 (必需)
location 资源位置 字符串 (必需)
标记 资源标记 标记名称和值的字典。 请参阅 模板中的标记
kind 此 Web 测试监视的 WebTest 类型。 选项包括 ping、多步骤和标准。 “multistep”
“ping”
“standard”
properties 描述 Azure 资源的 Web 测试的元数据。 WebTestProperties

WebTestProperties

名称 说明
配置 WebTest 的 XML 配置规范。 WebTestPropertiesConfiguration
说明 此 WebTest 的用户定义说明。 字符串
已启用 测试是否受到主动监视。 bool
频率 此 WebTest 的测试运行间隔(以秒为单位)。 默认值为 300。 int
种类 Web 测试的类型是,有效的选项是 ping、多步骤和标准。 “multistep”
“ping”
需要“标准” ()
位置 一个列表,其中列出了从何处实际运行测试,以便为应用程序的可访问性提供全球覆盖。 WebTestGeolocation[] (必需的)
名称 用户定义的名称(如果此 WebTest)。 字符串 (必需)
请求 请求属性的集合 WebTestPropertiesRequest
RetryEnabled 如果此 Web 测试失败,则允许重试。 bool
SyntheticMonitorId 此 WebTest 的唯一 ID。 此值通常与“名称”字段相同。 字符串 (必需)
超时 秒,直到此 WebTest 超时并失败。 默认值为 30。 int
ValidationRules 验证规则属性的集合 WebTestPropertiesValidationRules

WebTestPropertiesConfiguration

名称 说明
WebTest 要针对应用程序运行的 WebTest 的 XML 规范。 字符串

WebTestGeolocation

名称 说明
ID 要从其运行的 WebTest 的位置 ID。 字符串

WebTestPropertiesRequest

名称 说明
FollowRedirects 遵循此 Web 测试的重定向。 bool
标头 要添加到 WebTest 调用的标头及其值的列表。 HeaderField[]
HttpVerb 用于此 Web 测试的 Http 谓词。 字符串
ParseDependentRequests 分析此 WebTest 的依赖请求。 bool
RequestBody 要使用此 Web 测试发送的 Base64 编码字符串正文。 字符串
RequestUrl 要测试的 URL 位置。 字符串

标头字段

名称 说明
标头的名称。 string
value 标头的值。 字符串

WebTestPropertiesValidationRules

名称 说明
ContentValidation 内容验证属性的集合 WebTestPropertiesValidationRulesContentValidation
ExpectedHttpStatusCode 验证 WebTest 是否返回提供的 http 状态代码。 int
IgnoreHttpStatusCode 设置后,验证将忽略状态代码。 bool
SSLCertRemainingLifetimeCheck 在现有 SSL 证书过期之前,仍有几天检查。 值必须为正,SSLCheck 必须设置为 true。 int
SSLCheck 检查 SSL 证书是否仍然有效。 bool

WebTestPropertiesValidationRulesContentValidation

名称 说明
ContentMatch 在 WebTest 的返回中要查找的内容。 不得为 null 或空。 字符串
IgnoreCase 设置此值后,ContentMatch 验证不区分大小写。 bool
PassIfTextFound 如果为 true,则如果存在与 ContentMatch 字符串匹配项的匹配项,则会通过验证。 如果为 false,则存在匹配项时验证将失败 bool

快速入门模板

以下快速入门模板部署此资源类型。

模板 说明
动态 Web 测试创建

部署到 Azure
创建任意数量的 App Insights Web (ping) 测试。
可用性测试的指标警报规则

部署到 Azure
此模板创建 Application Insights 可用性测试以及用于监视它的指标警报规则。

ARM 模板资源定义

Webtests 资源类型可以通过针对以下操作进行部署:

有关每个 API 版本中更改的属性的列表,请参阅 更改日志

资源格式

若要创建 Microsoft.Insights/webtests 资源,请将以下 JSON 添加到模板。

{
  "type": "Microsoft.Insights/webtests",
  "apiVersion": "2022-06-15",
  "name": "string",
  "location": "string",
  "tags": {
    "tagName1": "tagValue1",
    "tagName2": "tagValue2"
  },
  "kind": "string",
  "properties": {
    "Configuration": {
      "WebTest": "string"
    },
    "Description": "string",
    "Enabled": "bool",
    "Frequency": "int",
    "Kind": "string",
    "Locations": [
      {
        "Id": "string"
      }
    ],
    "Name": "string",
    "Request": {
      "FollowRedirects": "bool",
      "Headers": [
        {
          "key": "string",
          "value": "string"
        }
      ],
      "HttpVerb": "string",
      "ParseDependentRequests": "bool",
      "RequestBody": "string",
      "RequestUrl": "string"
    },
    "RetryEnabled": "bool",
    "SyntheticMonitorId": "string",
    "Timeout": "int",
    "ValidationRules": {
      "ContentValidation": {
        "ContentMatch": "string",
        "IgnoreCase": "bool",
        "PassIfTextFound": "bool"
      },
      "ExpectedHttpStatusCode": "int",
      "IgnoreHttpStatusCode": "bool",
      "SSLCertRemainingLifetimeCheck": "int",
      "SSLCheck": "bool"
    }
  }
}

属性值

webtests

名称 说明 Value
type 资源类型 “Microsoft.Insights/webtests”
apiVersion 资源 API 版本 '2022-06-15'
name 资源名称 字符串 (必需)
location 资源位置 字符串 (必需)
标记 资源标记 标记名称和值的字典。 请参阅 模板中的标记
kind 此 Web 测试监视的 WebTest 类型。 选项包括 ping、多步骤和标准。 “multistep”
'ping'
'standard'
properties 描述 Azure 资源的 Web 测试的元数据。 WebTestProperties

WebTestProperties

名称 说明
配置 WebTest 的 XML 配置规范。 WebTestPropertiesConfiguration
说明 此 WebTest 的用户定义说明。 字符串
已启用 测试是否受到主动监视。 bool
频率 此 WebTest 的测试运行之间的间隔(以秒为单位)。 默认值为 300。 int
种类 这是 Web 测试的类型,有效选项为 ping、多步骤和标准。 “multistep”
'ping'
“standard” (必需)
位置 一个列表,其中列出了从何处实际运行测试,以便为应用程序的可访问性提供全球覆盖。 WebTestGeolocation[] (必需)
名称 如果此 WebTest,则为用户定义的名称。 字符串 (必需)
请求 请求属性的集合 WebTestPropertiesRequest
RetryEnabled 如果此 Web 测试失败,请允许重试。 bool
SyntheticMonitorId 此 WebTest 的唯一 ID。 这通常与“名称”字段的值相同。 字符串 (必需)
超时 直到此 WebTest 超时并失败的秒数。 默认值为 30。 int
ValidationRules 验证规则属性的集合 WebTestPropertiesValidationRules

WebTestPropertiesConfiguration

名称 说明
WebTest 要针对应用程序运行的 WebTest 的 XML 规范。 字符串

WebTestGeolocation

名称 说明
ID 要从其运行的 WebTest 的位置 ID。 字符串

WebTestPropertiesRequest

名称 说明
FollowRedirects 遵循此 Web 测试的重定向。 bool
标头 要添加到 WebTest 调用的标头及其值的列表。 HeaderField[]
HttpVerb 用于此 Web 测试的 Http 谓词。 字符串
ParseDependentRequests 分析此 WebTest 的依赖请求。 bool
RequestBody 使用此 Web 测试发送的 Base64 编码字符串正文。 字符串
RequestUrl 要测试的 URL 位置。 字符串

标头字段

名称 说明
标头的名称。 string
value 标头的值。 字符串

WebTestPropertiesValidationRules

名称 说明
ContentValidation 内容验证属性的集合 WebTestPropertiesValidationRulesContentValidation
ExpectedHttpStatusCode 验证 WebTest 是否返回提供的 http 状态代码。 int
IgnoreHttpStatusCode 设置后,验证将忽略状态代码。 bool
SSLCertRemainingLifetimeCheck 在现有 SSL 证书过期之前,仍有几天检查。 值必须为正值,并且 SSLCheck 必须设置为 true。 int
SSLCheck 检查 SSL 证书是否仍然有效。 bool

WebTestPropertiesValidationRulesContentValidation

名称 说明
ContentMatch 在 WebTest 的返回中要查找的内容。 不得为 null 或为空。 字符串
IgnoreCase 设置此值后,ContentMatch 验证不区分大小写。 bool
PassIfTextFound 如果为 true,则如果存在与 ContentMatch 字符串匹配的匹配项,将通过验证。 如果为 false,则存在匹配项时验证将失败 bool

快速入门模板

以下快速入门模板部署此资源类型。

模板 说明
动态 Web 测试创建

部署到 Azure
创建任意数量的 App Insights Web (ping) 测试。
可用性测试的指标警报规则

部署到 Azure
此模板创建 Application Insights 可用性测试以及用于监视它的指标警报规则。

Terraform (AzAPI 提供程序) 资源定义

可以使用面向以下操作部署 Webtests 资源类型:

  • 资源组

有关每个 API 版本中已更改属性的列表,请参阅 更改日志

资源格式

若要创建 Microsoft.Insights/webtests 资源,请将以下 Terraform 添加到模板。

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.Insights/webtests@2022-06-15"
  name = "string"
  location = "string"
  parent_id = "string"
  tags = {
    tagName1 = "tagValue1"
    tagName2 = "tagValue2"
  }
  body = jsonencode({
    properties = {
      Configuration = {
        WebTest = "string"
      }
      Description = "string"
      Enabled = bool
      Frequency = int
      Kind = "string"
      Locations = [
        {
          Id = "string"
        }
      ]
      Name = "string"
      Request = {
        FollowRedirects = bool
        Headers = [
          {
            key = "string"
            value = "string"
          }
        ]
        HttpVerb = "string"
        ParseDependentRequests = bool
        RequestBody = "string"
        RequestUrl = "string"
      }
      RetryEnabled = bool
      SyntheticMonitorId = "string"
      Timeout = int
      ValidationRules = {
        ContentValidation = {
          ContentMatch = "string"
          IgnoreCase = bool
          PassIfTextFound = bool
        }
        ExpectedHttpStatusCode = int
        IgnoreHttpStatusCode = bool
        SSLCertRemainingLifetimeCheck = int
        SSLCheck = bool
      }
    }
    kind = "string"
  })
}

属性值

webtests

名称 说明 Value
type 资源类型 “Microsoft.Insights/webtests@2022-06-15”
name 资源名称 字符串 (必需)
location 资源位置 字符串 (必需)
parent_id 若要部署到资源组,请使用该资源组的 ID。 字符串 (必需)
标记 资源标记 标记名称和值的字典。
kind 此 Web 测试监视的 WebTest 类型。 选项包括 ping、多步骤和标准。 “multistep”
“ping”
“standard”
properties 描述 Azure 资源的 Web 测试的元数据。 WebTestProperties

WebTestProperties

名称 说明
配置 WebTest 的 XML 配置规范。 WebTestPropertiesConfiguration
说明 此 WebTest 的用户定义说明。 字符串
已启用 测试是否受到主动监视。 bool
频率 此 WebTest 的测试运行之间的间隔(以秒为单位)。 默认值为 300。 int
种类 Web 测试的类型是,有效的选项是 ping、多步骤和标准。 “multistep”
“ping”
需要“标准” ()
位置 一个列表,其中列出了从何处实际运行测试,以便为应用程序的可访问性提供全球覆盖。 WebTestGeolocation[] (必需的)
名称 用户定义的名称(如果此 WebTest)。 字符串 (必需)
请求 请求属性的集合 WebTestPropertiesRequest
RetryEnabled 如果此 Web 测试失败,则允许重试。 bool
SyntheticMonitorId 此 WebTest 的唯一 ID。 此值通常与“名称”字段相同。 字符串 (必需)
超时 秒,直到此 WebTest 超时并失败。 默认值为 30。 int
ValidationRules 验证规则属性的集合 WebTestPropertiesValidationRules

WebTestPropertiesConfiguration

名称 说明
WebTest 要针对应用程序运行的 WebTest 的 XML 规范。 字符串

WebTestGeolocation

名称 说明
ID 要从其运行的 WebTest 的位置 ID。 字符串

WebTestPropertiesRequest

名称 说明
FollowRedirects 遵循此 Web 测试的重定向。 bool
标头 要添加到 WebTest 调用的标头及其值的列表。 HeaderField[]
HttpVerb 用于此 Web 测试的 Http 谓词。 字符串
ParseDependentRequests 分析此 WebTest 的依赖请求。 bool
RequestBody 要使用此 Web 测试发送的 Base64 编码字符串正文。 字符串
RequestUrl 要测试的 URL 位置。 字符串

标头字段

名称 说明
标头的名称。 string
value 标头的值。 字符串

WebTestPropertiesValidationRules

名称 说明
ContentValidation 内容验证属性的集合 WebTestPropertiesValidationRulesContentValidation
ExpectedHttpStatusCode 验证 WebTest 是否返回提供的 http 状态代码。 int
IgnoreHttpStatusCode 设置后,验证将忽略状态代码。 bool
SSLCertRemainingLifetimeCheck 在现有 SSL 证书过期之前,仍有几天检查。 值必须为正,SSLCheck 必须设置为 true。 int
SSLCheck 检查 SSL 证书是否仍然有效。 bool

WebTestPropertiesValidationRulesContentValidation

名称 说明
ContentMatch 在 WebTest 的返回中要查找的内容。 不得为 null 或空。 字符串
IgnoreCase 设置此值后,ContentMatch 验证不区分大小写。 bool
PassIfTextFound 如果为 true,则如果存在与 ContentMatch 字符串匹配项的匹配项,则会通过验证。 如果为 false,则存在匹配项时验证将失败 bool