Skip to content

Commit 3d7de30

Browse files
authored
Update examples for New-AzApplicationInsightsWebTest (#24508)
1 parent a306136 commit 3d7de30

File tree

1 file changed

+39
-17
lines changed

1 file changed

+39
-17
lines changed

src/ApplicationInsights/ApplicationInsights.Autorest/examples/New-AzApplicationInsightsWebTest.md

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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
22
```powershell
33
$geoLocation = @()
44
$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "emea-nl-ams-azr"
@@ -8,6 +8,7 @@ New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name standar
88
-RequestUrl "https://www.bing.com" -RequestHttpVerb "GET" -TestName 'standard-pwsh01' `
99
-RuleExpectedHttpStatusCode 200 -Frequency 300 -Enabled -Timeout 120 -Kind 'standard' -RetryEnabled -GeoLocation $geoLocation
1010
```
11+
1112
```output
1213
Name Location WebTestKind ResourceGroupName Enabled
1314
---- -------- ----------- ----------------- -------
@@ -18,7 +19,28 @@ This command creates or updates an standard kind of the Application Insights web
1819

1920
We enter hidden-link in the `Tag` parameter to associate WebTest and Application Insights.
2021

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
2244
```powershell
2345
$geoLocation = @()
2446
$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "emea-nl-ams-azr"
@@ -29,6 +51,7 @@ New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name 'pingwe
2951
-Kind 'ping' -RequestUrl 'https://cn.bing.com' -RequestParseDependent -RuleExpectedHttpStatusCode 200 `
3052
-ContentMatch "status"
3153
```
54+
3255
```output
3356
Name Location WebTestKind ResourceGroupName Enabled
3457
---- -------- ----------- ----------------- -------
@@ -37,7 +60,7 @@ pingwebtest-pwsh01 westus2 ping azpwsh-rg-test True
3760

3861
This command creates or updates an ping kind of the Application Insights web test.
3962

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
4164
```powershell
4265
$geoLocation = @()
4366
$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "emea-nl-ams-azr"
@@ -46,20 +69,20 @@ New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name 'pingwe
4669
-Tag @{"hidden-link:/subscriptions/xxxxxxxxxx-xxxx-xxxxx-xxxxxxxxxxxx/resourceGroups/azpwsh-rg-test/providers/microsoft.insights/components/appinsights-portal01" = "Resource"} `
4770
-GeoLocation $geoLocation -RetryEnabled -Enabled -Frequency 300 -Timeout 90 `
4871
-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>
5477
<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&#x20;content&#x20;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&#x20;content&#x20;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>
6386
</WebTest>"
6487
```
6588
```output
@@ -69,4 +92,3 @@ pingwebtest-pwsh01 westus2 ping azpwsh-rg-test True
6992
```
7093

7194
This command creates or updates an ping kind of the Application Insights web test with custom configuration.
72-

0 commit comments

Comments
 (0)