feedback icon indicating copy to clipboard operation
feedback copied to clipboard

Unable to create Application Insights Web Test via management rest api

Open piotrgradzinski opened this issue 4 years ago • 7 comments

Describe the bug Using the steps described here https://docs.microsoft.com/en-us/rest/api/application-insights/webtests/createorupdate I am trying to create new Web Test. I'm receiving Bad Request response due to the missing 'hidden-link' tag in request body. This requirement is not pointed in the documentation.

To Reproduce Trying to send the following request:

PUT https://management.azure.com/subscriptions/SUBSCRIPTION_ID/resourceGroups/RESOURCE_GROUP_NAME/providers/Microsoft.Insights/webtests/WEB_TEST_NAME?api-version=2015-05-01

{
    "location": "francecentral",
    "kind": "ping",
    "properties": {
        "Name": "NAME",
        "SyntheticMonitorId": "NAME",
        "Configuration": {
            "WebTest": "<WebTest Name=\"NAME\" Id=\"GUID\" 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\" Guid=\"GUID\" Version=\"1.1\" Url=\"URL\" ThinkTime=\"0\" Timeout=\"120\" ParseDependentRequests=\"False\" FollowRedirects=\"True\" RecordResult=\"True\" Cache=\"False\" ResponseTimeGoal=\"0\" Encoding=\"utf-8\" ExpectedHttpStatusCode=\"200\" ExpectedResponseUrl=\"\" ReportingName=\"\" IgnoreHttpStatusCode=\"False\" /></Items></WebTest>"
        },
        "Description": "",
        "Enabled": true,
        "Frequency": 300,
        "Timeout": 120,
        "Kind": "ping",
        "RetryEnabled": true,
        "Locations": [
            {
                "Id": "emea-ch-zrh-edge"
            }
        ]
    }
}

and receiving the following response:

{
    "code": "BadRequest",
    "message": "A single 'hidden-link' tag pointing to an existing AI component is required. Found none."
}

Adding tags property solves the issue:

{
    "tags": {
        "hidden-link:/subscriptions/SUBSCRIPTION_ID/resourceGroups/RESOURCE_GROUP_NAME/providers/microsoft.insights/components/APP_INSIGHTS_NAME": "Resource"
    }
}

Expected behavior Update the documentation for webTestCreate and webTestUpdate sections.

piotrgradzinski avatar Feb 16 '21 13:02 piotrgradzinski

Thank you for creating the issue! One of our team members will get back to you shortly with additional information. If this is a product issue, please close this and contact the particular product's support instead (see https://support.microsoft.com/allproducts for the list of support websites).

welcome[bot] avatar Feb 16 '21 13:02 welcome[bot]

@rootsmusic And how's that solves the issue?

piotrgradzinski avatar Jul 26 '21 23:07 piotrgradzinski

@piotrgradzinski Please move this issue to https://github.com/Azure/azure-rest-api-specs

rootsmusic avatar Aug 02 '21 22:08 rootsmusic

I have just hit this issue and the latest documentation has --tags as optional and no mention of hidden tags in the parameters section (but does under the example???), yet Azure CLI v2.6.1 requires hidden tags when running az monitor app-insights web-test create causes error:

azure.core.exceptions.HttpResponseError: (BadRequest) A single 'hidden-link' tag pointing to an existing AI component is required. Found none.
Code: BadRequest
Message: A single 'hidden-link' tag pointing to an existing AI component is required. Found none.
Inner error: {
    "trace": [
        "System.ArgumentException"
    ]
}
cli.azure.cli.core.azclierror: (BadRequest) A single 'hidden-link' tag pointing to an existing AI component is required. Found none.
Code: BadRequest
Message: A single 'hidden-link' tag pointing to an existing AI component is required. Found none.
Inner error: {
    "trace": [
        "System.ArgumentException"
    ]
}
az_command_data_logger: (BadRequest) A single 'hidden-link' tag pointing to an existing AI component is required. Found none.
Code: BadRequest
Message: A single 'hidden-link' tag pointing to an existing AI component is required. Found none.
Inner error: {
    "trace": [
        "System.ArgumentException"
    ]
}

Documentation: https://learn.microsoft.com/en-us/cli/azure/monitor/app-insights/web-test?view=azure-cli-latest#az-monitor-app-insights-web-test-create

r300mrg avatar Jun 07 '24 15:06 r300mrg

Any updates on this issue?

jdudleyonyxtech avatar Nov 11 '24 11:11 jdudleyonyxtech

We also recive this Issue when attempting to create this availability test.

JFR1001 avatar Nov 15 '24 12:11 JFR1001

Seeing the same thing here, using Bicep templates, thank goodness for @piotrgradzinski with the sample hidden link syntax otherwise I would have been fumbling in the dark.

jeffrichards avatar Dec 16 '24 19:12 jeffrichards