Azure CLI创建URL Ping测试报错:缺少指定AI组件的hidden-link标签
错误提示A single 'hidden-link' tag pointing to an existing AI component is required. Found none.的原因是hidden-link标签的格式不符合Azure CLI要求,Azure需要标签以key=value的明确键值对形式传递,而非单纯的字符串。
正确的标签格式
将--tags参数修改为键值对格式,用双引号包裹完整标签内容,确保hidden-link作为键,后面紧跟Application Insights组件的完整资源ID作为值:
--tags "hidden-link:/subscriptions/{subid}/resourceGroups/{rg}/providers/microsoft.insights/components/{appinsightname}"
注意替换占位符{subid}、{rg}、{appinsightname}为你的实际订阅ID、资源组名称和Application Insights组件名称。
修正后的完整命令
az monitor app-insights web-test create --location "Australia East" --tags "hidden-link:/subscriptions/{subid}/resourceGroups/{rg}/providers/microsoft.insights/components/{appinsightname}" --description "Ping web test alert for mytestwebapp" --enabled true --frequency 900 --web-test-kind "standard" --locations Id="emea-au-syd-edge" --defined-web-test-name "my-webtest-my-component" --http-verb "GET" --request-url "https://myurl.net/" --retry-enabled true --synthetic-monitor-id "my-webtest-my-component" --timeout 120 --ssl-lifetime-check 100 --ssl-check true --resource-group "{rgname}" --name "my-webtest-my-component"
额外注意事项
- 确认指定的Application Insights组件已存在于对应的订阅和资源组中,否则即使标签格式正确,仍会触发类似错误。
- 如果在Windows CMD环境下执行命令,可能需要调整引号转义方式,将外层双引号改为单引号,或者对内部引号进行转义。
内容的提问来源于stack exchange,提问作者Heshan
相关产品推荐
相关产品推荐

