Share via


az monitor app-insights web-test

Note

This reference is part of the application-insights extension for the Azure CLI (version 2.55.0 or higher). The extension will automatically install the first time you run an az monitor app-insights web-test command. Learn more about extensions.

Manage web test with application insights.

Commands

Name Description Type Status
az monitor app-insights web-test create

Create an Application Insights web test definition.

Extension GA
az monitor app-insights web-test delete

Delete an Application Insights web test.

Extension GA
az monitor app-insights web-test list

Get all Application Insights web tests defined for the specified component. And Get all Application Insights web tests defined within a specified resource group. And Get all Application Insights web test alerts definitions within a subscription.

Extension GA
az monitor app-insights web-test show

Get a specific Application Insights web test definition.

Extension GA
az monitor app-insights web-test update

Update an Application Insights web test definition.

Extension GA

az monitor app-insights web-test create

Create an Application Insights web test definition.

az monitor app-insights web-test create --name
                                        --resource-group
                                        [--content-validation]
                                        [--defined-web-test-name]
                                        [--description]
                                        [--enabled {false, true}]
                                        [--expected-status-code]
                                        [--follow-redirects {false, true}]
                                        [--frequency]
                                        [--headers]
                                        [--http-verb]
                                        [--ignore-status-code {false, true}]
                                        [--kind {multistep, ping}]
                                        [--location]
                                        [--locations]
                                        [--parse-requests {false, true}]
                                        [--request-body]
                                        [--request-url]
                                        [--retry-enabled {false, true}]
                                        [--ssl-check {false, true}]
                                        [--ssl-lifetime-check]
                                        [--synthetic-monitor-id]
                                        [--tags]
                                        [--timeout]
                                        [--web-test]
                                        [--web-test-kind {multistep, ping, standard}]

Examples

webTestCreate

az monitor app-insights web-test create --kind "ping" --location "South Central US" --web-test "<WebTest Name=\"my-webtest\" Id=\"678ddf96-1ab8-44c8-9274-123456789abc\" 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=\"a4162485-9114-fcfc-e086-123456789abc\" Version=\"1.1\" Url=\"http://my-component.azurewebsites.net\" ThinkTime=\"0\" Timeout=\"120\" ParseDependentRequests=\"True\" FollowRedirects=\"True\" RecordResult=\"True\" Cache=\"False\" ResponseTimeGoal=\"0\" Encoding=\"utf-8\" ExpectedHttpStatusCode=\"200\" ExpectedResponseUrl=\"\" ReportingName=\"\" IgnoreHttpStatusCode=\"False\" /></Items></WebTest>" --description "Ping web test alert for mytestwebapp" --enabled true --frequency 900 --web-test-kind "ping" --locations Id="us-fl-mia-edge" --defined-web-test-name "my-webtest-my-component" --retry-enabled true --synthetic-monitor-id "my-webtest-my-component" --timeout 120 --resource-group "my-resource-group" --name "my-webtest-my-component" --tags hidden-link:XX=XX

webTestCreateStandard

az monitor app-insights web-test create --location "South Central US" --description "Ping web test alert for mytestwebapp" --enabled true --frequency 900 --web-test-kind "standard" --locations Id="us-fl-mia-edge" --defined-web-test-name "my-webtest-my-component" --http-verb "POST" --request-body "SGVsbG8gd29ybGQ=" --request-url "https://bing.com" --retry-enabled true --synthetic-monitor-id "my-webtest-my-component" --timeout 120 --ssl-lifetime-check 100 --ssl-check true --resource-group "my-resource-group" --name "my-webtest-my-component" --tags hidden-link:XX=XX

Required Parameters

--name --web-test-name -n

The name of the Application Insights WebTest resource.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--content-validation

The collection of content validation properties.

Usage: --content-validation content-match=XX ignore-case=XX pass-if-text-found=XX

content-match: Content to look for in the return of the WebTest. Must not be null or empty. ignore-case: When set, this value makes the ContentMatch validation case insensitive. pass-if-text-found: When true, validation will pass if there is a match for the ContentMatch string. If false, validation will fail if there is a match.

--defined-web-test-name

User defined name if this WebTest.

--description

User defined description for this WebTest.

--enabled

Is the test actively being monitored.

Accepted values: false, true
--expected-status-code

Validate that the WebTest returns the http status code provided.

--follow-redirects

Follow redirects for this web test.

Accepted values: false, true
--frequency

Interval in seconds between test runs for this WebTest. Default value is 300.

--headers

List of headers and their values to add to the WebTest call.

Usage: --headers key=XX value=XX

key: The name of the header. value: The value of the header.

Multiple actions can be specified by using more than one --headers argument.

--http-verb

Http verb to use for this web test.

--ignore-status-code

When set, validation will ignore the status code.

Accepted values: false, true
--kind

The kind of WebTest that this web test watches. Choices are ping and multistep.

Accepted values: multistep, ping
--location -l

Location. Values from: az account list-locations. You can configure the default location using az configure --defaults location=<location>.

--locations

A list of where to physically run the tests from to give global coverage for accessibility of your application.

Usage: --locations Id=XX

Id: Location ID for the WebTest to run from.

Multiple actions can be specified by using more than one --locations argument.

--parse-requests

Parse Dependent request for this WebTest.

Accepted values: false, true
--request-body

Base64 encoded string body to send with this web test.

--request-url

Url location to test.

--retry-enabled

Allow for retries should this WebTest fail.

Accepted values: false, true
--ssl-check

Checks to see if the SSL cert is still valid.

Accepted values: false, true
--ssl-lifetime-check

A number of days to check still remain before the the existing SSL cert expires. Value must be positive and the SSLCheck must be set to true.

--synthetic-monitor-id

Unique ID of this WebTest. This is typically the same value as the Name field.

--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.

--timeout

Seconds until this WebTest will timeout and fail. Default value is 30.

--web-test

The XML specification of a WebTest to run against an application.

--web-test-kind

The kind of web test this is, valid choices are ping, multistep and standard.

Accepted values: multistep, ping, standard
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az monitor app-insights web-test delete

Delete an Application Insights web test.

az monitor app-insights web-test delete --name
                                        --resource-group
                                        [--yes]

Examples

webTestDelete

az monitor app-insights web-test delete --resource-group "my-resource-group" --name "my-webtest-01-mywebservice"

Required Parameters

--name --web-test-name -n

The name of the Application Insights WebTest resource.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--yes -y

Do not prompt for confirmation.

Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az monitor app-insights web-test list

Get all Application Insights web tests defined for the specified component. And Get all Application Insights web tests defined within a specified resource group. And Get all Application Insights web test alerts definitions within a subscription.

az monitor app-insights web-test list [--component-name]
                                      [--resource-group]

Examples

webTestListByComponent

az monitor app-insights web-test list --component-name "my-component" --resource-group "my-resource-group"

webTestListByResourceGroup

az monitor app-insights web-test list --resource-group "my-resource-group"

webTestList

az monitor app-insights web-test list

Optional Parameters

--component-name

The name of the Application Insights component resource.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az monitor app-insights web-test show

Get a specific Application Insights web test definition.

az monitor app-insights web-test show --name
                                      --resource-group

Examples

webTestGet

az monitor app-insights web-test show --resource-group "my-resource-group" --name "my-webtest-01-mywebservice"

Required Parameters

--name --web-test-name -n

The name of the Application Insights WebTest resource.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az monitor app-insights web-test update

Update an Application Insights web test definition.

az monitor app-insights web-test update --name
                                        --resource-group
                                        [--add]
                                        [--content-validation]
                                        [--defined-web-test-name]
                                        [--description]
                                        [--enabled {false, true}]
                                        [--expected-status-code]
                                        [--follow-redirects {false, true}]
                                        [--force-string]
                                        [--frequency]
                                        [--headers]
                                        [--http-verb]
                                        [--ignore-status-code {false, true}]
                                        [--kind {multistep, ping}]
                                        [--location]
                                        [--locations]
                                        [--parse-requests {false, true}]
                                        [--remove]
                                        [--request-body]
                                        [--request-url]
                                        [--retry-enabled {false, true}]
                                        [--set]
                                        [--ssl-check {false, true}]
                                        [--ssl-lifetime-check]
                                        [--synthetic-monitor-id]
                                        [--tags]
                                        [--timeout]
                                        [--web-test]
                                        [--web-test-kind {multistep, ping, standard}]

Examples

webTestUpdate

az monitor app-insights web-test update --kind "ping" --location "South Central US" --web-test "<WebTest Name=\"my-webtest\" Id=\"678ddf96-1ab8-44c8-9274-123456789abc\" Enabled=\"True\" CssProjectStructure=\"\" CssIteration=\"\" Timeout=\"30\" 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=\"a4162485-9114-fcfc-e086-123456789abc\" Version=\"1.1\" Url=\"http://my-component.azurewebsites.net\" ThinkTime=\"0\" Timeout=\"30\" ParseDependentRequests=\"True\" FollowRedirects=\"True\" RecordResult=\"True\" Cache=\"False\" ResponseTimeGoal=\"0\" Encoding=\"utf-8\" ExpectedHttpStatusCode=\"200\" ExpectedResponseUrl=\"\" ReportingName=\"\" IgnoreHttpStatusCode=\"False\" /></Items></WebTest>" --frequency 600 --web-test-kind "ping" --locations Id="us-fl-mia-edge" --locations Id="apac-hk-hkn-azr" --defined-web-test-name "my-webtest-my-component" --synthetic-monitor-id "my-webtest-my-component" --timeout 30 --resource-group "my-resource-group" --name "my-webtest-my-component"

Required Parameters

--name --web-test-name -n

The name of the Application Insights WebTest resource.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.

Default value: []
--content-validation

The collection of content validation properties.

Usage: --content-validation content-match=XX ignore-case=XX pass-if-text-found=XX

content-match: Content to look for in the return of the WebTest. Must not be null or empty. ignore-case: When set, this value makes the ContentMatch validation case insensitive. pass-if-text-found: When true, validation will pass if there is a match for the ContentMatch string. If false, validation will fail if there is a match.

--defined-web-test-name

User defined name if this WebTest.

--description

User defined description for this WebTest.

--enabled

Is the test actively being monitored.

Accepted values: false, true
--expected-status-code

Validate that the WebTest returns the http status code provided.

--follow-redirects

Follow redirects for this web test.

Accepted values: false, true
--force-string

When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.

Default value: False
--frequency

Interval in seconds between test runs for this WebTest. Default value is 300.

--headers

List of headers and their values to add to the WebTest call.

Usage: --headers key=XX value=XX

key: The name of the header. value: The value of the header.

Multiple actions can be specified by using more than one --headers argument.

--http-verb

Http verb to use for this web test.

--ignore-status-code

When set, validation will ignore the status code.

Accepted values: false, true
--kind

The kind of WebTest that this web test watches. Choices are ping and multistep.

Accepted values: multistep, ping
--location -l

Location. Values from: az account list-locations. You can configure the default location using az configure --defaults location=<location>.

--locations

A list of where to physically run the tests from to give global coverage for accessibility of your application.

Usage: --locations Id=XX

Id: Location ID for the WebTest to run from.

Multiple actions can be specified by using more than one --locations argument.

--parse-requests

Parse Dependent request for this WebTest.

Accepted values: false, true
--remove

Remove a property or an element from a list. Example: --remove property.list <indexToRemove> OR --remove propertyToRemove.

Default value: []
--request-body

Base64 encoded string body to send with this web test.

--request-url

Url location to test.

--retry-enabled

Allow for retries should this WebTest fail.

Accepted values: false, true
--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=<value>.

Default value: []
--ssl-check

Checks to see if the SSL cert is still valid.

Accepted values: false, true
--ssl-lifetime-check

A number of days to check still remain before the the existing SSL cert expires. Value must be positive and the SSLCheck must be set to true.

--synthetic-monitor-id

Unique ID of this WebTest. This is typically the same value as the Name field.

--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.

--timeout

Seconds until this WebTest will timeout and fail. Default value is 30.

--web-test

The XML specification of a WebTest to run against an application.

--web-test-kind

The kind of web test this is, valid choices are ping, multistep and standard.

Accepted values: multistep, ping, standard
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.