I am trying to create a template for App Insights web availability tests. I am using bicep, and this is my template:
param location string = resourceGroup().location
param pingText string = ''
param appInsightsResource string
param tests array
resource tests_0_name 'Microsoft.Insights/webtests@2015-05-01' = {
name: tests[0].name
location: location
tags: {
'hidden-link:${appInsightsResource}': 'Resource'
}
properties: {
Name: tests[0].name
Description: tests[0].description
Enabled: true
Frequency: tests[0].frequency_secs
Timeout: tests[0].timeout_secs
Kind: 'ping'
Locations: tests[0].locations
Configuration: {
WebTest: '<WebTest Name="${tests[0].name}" Enabled="True" CssProjectStructure="" CssIteration="" Timeout="120" WorkItemIds="" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010" Description="" CredentialUserName="" CredentialPassword="" PreAuthenticate="True" Proxy="default" StopOnError="False" RecordedResultFile="" ResultsLocale=""> <Items> <Request Method="GET" Version="1.1" Url="${tests[0].url}" ThinkTime="0" Timeout="300" ParseDependentRequests="True" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0" Encoding="utf-8" ExpectedHttpStatusCode="${tests[0].expected}" ExpectedResponseUrl="" ReportingName="" IgnoreHttpStatusCode="False" /> </Items> <ValidationRules> <ValidationRule Classname="Microsoft.VisualStudio.TestTools.WebTesting.Rules.ValidationRuleFindText, Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" DisplayName="Find Text" Description="Verifies the existence of the specified text in the response." Level="High" ExecutionOrder="BeforeDependents"> <RuleParameters> <RuleParameter Name="FindText" Value="${pingText}" /> <RuleParameter Name="IgnoreCase" Value="False" /> <RuleParameter Name="UseRegularExpression" Value="False" /> <RuleParameter Name="PassIfTextFound" Value="True" /> </RuleParameters> </ValidationRule> </ValidationRules> </WebTest>'
}
SyntheticMonitorId: tests[0].name
}
}
and also a parameters file:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appInsightsResource": {
"value": "myappinsight"
},
"tests": {
"value": [
{
"name": "5121",
"url": "http://www.microsoft.com",
"expected": 200,
"frequency_secs": 300,
"timeout_secs": 30,
"failedLocationCount": 1,
"description": "a description for test1",
"guid": "5122",
"locations": [
{
"Id": "us-il-ch1-azr"
}
]
},
{
"name": "1242",
"url": "http://www.microsoft.com",
"expected": 404,
"frequency_secs": 300,
"timeout_secs": 30,
"failedLocationCount": 1,
"description": "a description for test3",
"guid": "5211",
"locations": [
{
"Id": "us-il-ch1-azr"
}
]
}
]
}
}
}
The problem is that, when I create this I get an error {"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.","details":[{"code":"BadRequest","message":"A single 'hidden-link' tag pointing to an existing AI component is required. Found none."}]} "A single 'hidden-link' tag pointing to an existing AI component is required. Found none. As you can see, I have a tag with hidden link, but Azure points to my tests, which I suppose do not have this tags, I don't know how to add them or what do to to make this work.


