MicrosoftDocs / feedback

đŸ“¢ docs.microsoft.com site feedback
https://learn.microsoft.com
Creative Commons Attribution 4.0 International
239 stars 160 forks source link

Unable to create Application Insights Web Test via management rest api #3491

Open piotrgradzinski opened 3 years ago

piotrgradzinski commented 3 years ago

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.

welcome[bot] commented 3 years ago

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).

piotrgradzinski commented 3 years ago

@rootsmusic And how's that solves the issue?

rootsmusic commented 3 years ago

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

r300mrg commented 3 months ago

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