1
- ### Example 1: Creates or updates an standard kind of the Application Insights web test
1
+ ### Example 1: Creates or updates a standard kind of the Application Insights web test
2
2
``` powershell
3
3
$geoLocation = @()
4
4
$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "emea-nl-ams-azr"
@@ -8,6 +8,7 @@ New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name standar
8
8
-RequestUrl "https://www.bing.com" -RequestHttpVerb "GET" -TestName 'standard-pwsh01' `
9
9
-RuleExpectedHttpStatusCode 200 -Frequency 300 -Enabled -Timeout 120 -Kind 'standard' -RetryEnabled -GeoLocation $geoLocation
10
10
```
11
+
11
12
``` output
12
13
Name Location WebTestKind ResourceGroupName Enabled
13
14
---- -------- ----------- ----------------- -------
@@ -18,7 +19,28 @@ This command creates or updates an standard kind of the Application Insights web
18
19
19
20
We enter hidden-link in the ` Tag ` parameter to associate WebTest and Application Insights.
20
21
21
- ### Example 2: Creates or updates an ping kind of the Application Insights web test
22
+ ### Example 2: Creates or updates a standard kind of the Application Insights web test in disabled state
23
+ ``` powershell
24
+ $geoLocation = @()
25
+ $geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "emea-nl-ams-azr"
26
+ $geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "us-ca-sjc-azr"
27
+ New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name standard-pwsh01 -Location 'westus2' `
28
+ -Tag @{"hidden-link:/subscriptions/xxxxxxxxxx-xxxx-xxxxx-xxxxxxxxxxxx/resourceGroups/azpwsh-rg-test/providers/microsoft.insights/components/appinsights-portal01" = "Resource"} `
29
+ -RequestUrl "https://www.bing.com" -RequestHttpVerb "GET" -TestName 'standard-pwsh01' `
30
+ -RuleExpectedHttpStatusCode 200 -Frequency 300 -Enabled:$false -Timeout 120 -Kind 'standard' -RetryEnabled -GeoLocation $geoLocation
31
+ ```
32
+
33
+ ``` output
34
+ Name Location WebTestKind ResourceGroupName Enabled
35
+ ---- -------- ----------- ----------------- -------
36
+ standard-pwsh01 westus2 standard azpwsh-rg-test False
37
+ ```
38
+
39
+ This command creates or updates a standard kind of the Application Insights web test in disabled state.
40
+
41
+ The switch parameter "-Enabled" must be set explicitly to $false to disable the test.
42
+
43
+ ### Example 3: Creates or updates a ping kind of the Application Insights web test
22
44
``` powershell
23
45
$geoLocation = @()
24
46
$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "emea-nl-ams-azr"
@@ -29,6 +51,7 @@ New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name 'pingwe
29
51
-Kind 'ping' -RequestUrl 'https://cn.bing.com' -RequestParseDependent -RuleExpectedHttpStatusCode 200 `
30
52
-ContentMatch "status"
31
53
```
54
+
32
55
``` output
33
56
Name Location WebTestKind ResourceGroupName Enabled
34
57
---- -------- ----------- ----------------- -------
@@ -37,7 +60,7 @@ pingwebtest-pwsh01 westus2 ping azpwsh-rg-test True
37
60
38
61
This command creates or updates an ping kind of the Application Insights web test.
39
62
40
- ### Example 3 : Creates or updates an ping kind of the Application Insights web test with custom configuration
63
+ ### Example 4 : Creates or updates a ping kind of the Application Insights web test with custom configuration
41
64
``` powershell
42
65
$geoLocation = @()
43
66
$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "emea-nl-ams-azr"
@@ -46,20 +69,20 @@ New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name 'pingwe
46
69
-Tag @{"hidden-link:/subscriptions/xxxxxxxxxx-xxxx-xxxxx-xxxxxxxxxxxx/resourceGroups/azpwsh-rg-test/providers/microsoft.insights/components/appinsights-portal01" = "Resource"} `
47
70
-GeoLocation $geoLocation -RetryEnabled -Enabled -Frequency 300 -Timeout 90 `
48
71
-Kind 'ping' `
49
- -Configuration "<WebTest Name=`"basic-portal03`" Id=`"9407db10-5d84-487f-98a3-a1ee67bb98f0`" Enabled=`"True`" CssProjectStructure=`"`" CssIteration=`"`" Timeout=`"90`" WorkItemIds=`"`" xmlns=`"http://microsoft.com/schemas/VisualStudio/TeamTest/2010`" Description=`"`" CredentialUserName=`"`" CredentialPassword=`"`" PreAuthenticate=`"True`" Proxy=`"default`" StopOnError=`"False`" RecordedResultFile=`"`" ResultsLocale=`"`">
50
- <Items>
51
- <Request Method=`"GET`" Guid=`"a2025e53-0702-d03e-f311-5774ec16893d`" Version=`"1.1`" Url=`"https://www.bing.com`" ThinkTime=`"0`" Timeout=`"90`" ParseDependentRequests=`"True`" FollowRedirects=`"True`" RecordResult=`"True`" Cache=`"False`" ResponseTimeGoal=`"0`" Encoding=`"utf-8`" ExpectedHttpStatusCode=`"200`" ExpectedResponseUrl=`"`" ReportingName=`"`" IgnoreHttpStatusCode=`"False`" />
52
- </Items>
53
- <ValidationRules>
72
+ -Configuration "<WebTest Name=`"basic-portal03`" Id=`"9407db10-5d84-487f-98a3-a1ee67bb98f0`" Enabled=`"True`" CssProjectStructure=`"`" CssIteration=`"`" Timeout=`"90`" WorkItemIds=`"`" xmlns=`"http://microsoft.com/schemas/VisualStudio/TeamTest/2010`" Description=`"`" CredentialUserName=`"`" CredentialPassword=`"`" PreAuthenticate=`"True`" Proxy=`"default`" StopOnError=`"False`" RecordedResultFile=`"`" ResultsLocale=`"`">
73
+ <Items>
74
+ <Request Method=`"GET`" Guid=`"a2025e53-0702-d03e-f311-5774ec16893d`" Version=`"1.1`" Url=`"https://www.bing.com`" ThinkTime=`"0`" Timeout=`"90`" ParseDependentRequests=`"True`" FollowRedirects=`"True`" RecordResult=`"True`" Cache=`"False`" ResponseTimeGoal=`"0`" Encoding=`"utf-8`" ExpectedHttpStatusCode=`"200`" ExpectedResponseUrl=`"`" ReportingName=`"`" IgnoreHttpStatusCode=`"False`" />
75
+ </Items>
76
+ <ValidationRules>
54
77
<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`" ExectuionOrder=`"BeforeDependents`">
55
- <RuleParameters>
56
- <RuleParameter Name=`"FindText`" Value=`"test content match`" />
57
- <RuleParameter Name=`"IgnoreCase`" Value=`"False`" />
58
- <RuleParameter Name=`"UseRegularExpression`" Value=`"False`" />
59
- <RuleParameter Name=`"PassIfTextFound`" Value=`"True`" />
60
- </RuleParameters>
61
- </ValidationRule>
62
- </ValidationRules>
78
+ <RuleParameters>
79
+ <RuleParameter Name=`"FindText`" Value=`"test content match`" />
80
+ <RuleParameter Name=`"IgnoreCase`" Value=`"False`" />
81
+ <RuleParameter Name=`"UseRegularExpression`" Value=`"False`" />
82
+ <RuleParameter Name=`"PassIfTextFound`" Value=`"True`" />
83
+ </RuleParameters>
84
+ </ValidationRule>
85
+ </ValidationRules>
63
86
</WebTest>"
64
87
```
65
88
``` output
@@ -69,4 +92,3 @@ pingwebtest-pwsh01 westus2 ping azpwsh-rg-test True
69
92
```
70
93
71
94
This command creates or updates an ping kind of the Application Insights web test with custom configuration.
72
-
0 commit comments