From 2a0f58258033847ec40c4afe7990d02216ae4d89 Mon Sep 17 00:00:00 2001
From: azure-powershell-bot
<65331932+azure-powershell-bot@users.noreply.github.com>
Date: Tue, 26 Mar 2024 03:29:49 +0000
Subject: [PATCH] Move ApplicationInsights to main
---
.../New-AzApplicationInsightsWebTest.md | 56 +++-
.../exports/Get-AzApplicationInsights.ps1 | 8 +-
.../Get-AzApplicationInsightsApiKey.ps1 | 8 +-
...-AzApplicationInsightsContinuousExport.ps1 | 8 +-
...pplicationInsightsLinkedStorageAccount.ps1 | 8 +-
.../Get-AzApplicationInsightsMyWorkbook.ps1 | 8 +-
.../Get-AzApplicationInsightsWebTest.ps1 | 8 +-
.../Get-AzApplicationInsightsWorkbook.ps1 | 8 +-
...-AzApplicationInsightsWorkbookRevision.ps1 | 8 +-
...-AzApplicationInsightsWorkbookTemplate.ps1 | 8 +-
.../exports/New-AzApplicationInsights.ps1 | 8 +-
.../New-AzApplicationInsightsApiKey.ps1 | 8 +-
...-AzApplicationInsightsContinuousExport.ps1 | 8 +-
...pplicationInsightsLinkedStorageAccount.ps1 | 8 +-
.../New-AzApplicationInsightsMyWorkbook.ps1 | 8 +-
.../New-AzApplicationInsightsWebTest.ps1 | 42 ++-
.../New-AzApplicationInsightsWorkbook.ps1 | 8 +-
...-AzApplicationInsightsWorkbookTemplate.ps1 | 8 +-
.../exports/ProxyCmdletDefinitions.ps1 | 306 +++++++++++++++---
.../exports/Remove-AzApplicationInsights.ps1 | 8 +-
.../Remove-AzApplicationInsightsApiKey.ps1 | 8 +-
...-AzApplicationInsightsContinuousExport.ps1 | 8 +-
...pplicationInsightsLinkedStorageAccount.ps1 | 8 +-
...Remove-AzApplicationInsightsMyWorkbook.ps1 | 8 +-
.../Remove-AzApplicationInsightsWebTest.ps1 | 8 +-
.../Remove-AzApplicationInsightsWorkbook.ps1 | 8 +-
...-AzApplicationInsightsWorkbookTemplate.ps1 | 8 +-
...-AzApplicationInsightsContinuousExport.ps1 | 8 +-
.../Set-AzApplicationInsightsDailyCap.ps1 | 8 +-
.../Set-AzApplicationInsightsPricingPlan.ps1 | 8 +-
.../exports/Update-AzApplicationInsights.ps1 | 8 +-
...pplicationInsightsLinkedStorageAccount.ps1 | 8 +-
...Update-AzApplicationInsightsMyWorkbook.ps1 | 8 +-
...Update-AzApplicationInsightsWebTestTag.ps1 | 8 +-
.../Update-AzApplicationInsightsWorkbook.ps1 | 8 +-
...-AzApplicationInsightsWorkbookTemplate.ps1 | 8 +-
.../BuildTime/Models/PsProxyOutputs.cs | 23 +-
.../help/New-AzApplicationInsightsWebTest.md | 53 ++-
.../internal/Clear-AzApplicationInsights.ps1 | 8 +-
.../internal/Get-AzApplicationInsights.ps1 | 8 +-
.../Get-AzApplicationInsightsAnnotation.ps1 | 8 +-
...ationInsightsComponentAvailableFeature.ps1 | 8 +-
...InsightsComponentCurrentBillingFeature.ps1 | 8 +-
...tionInsightsComponentFeatureCapability.ps1 | 8 +-
...pplicationInsightsComponentPurgeStatus.ps1 | 8 +-
...pplicationInsightsComponentQuotaStatus.ps1 | 8 +-
.../internal/New-AzApplicationInsights.ps1 | 8 +-
.../New-AzApplicationInsightsAnnotation.ps1 | 8 +-
.../New-AzApplicationInsightsApiKey.ps1 | 8 +-
...-AzApplicationInsightsContinuousExport.ps1 | 8 +-
.../New-AzApplicationInsightsWebTest.ps1 | 42 ++-
.../internal/ProxyCmdletDefinitions.ps1 | 178 ++++++++--
...Remove-AzApplicationInsightsAnnotation.ps1 | 8 +-
.../internal/Set-AzApplicationInsights.ps1 | 8 +-
...InsightsComponentCurrentBillingFeature.ps1 | 8 +-
...-AzApplicationInsightsContinuousExport.ps1 | 8 +-
...date-AzApplicationInsightsComponentTag.ps1 | 8 +-
.../test-module.ps1 | 8 +-
.../test/loadEnv.ps1 | 2 +-
.../utils/Get-SubscriptionIdTestSafe.ps1 | 7 +
.../Az.ApplicationInsights.psd1 | 2 +-
.../help/Get-AzApplicationInsights.md | 25 +-
.../help/Get-AzApplicationInsightsApiKey.md | 21 +-
...t-AzApplicationInsightsContinuousExport.md | 21 +-
...ApplicationInsightsLinkedStorageAccount.md | 19 +-
.../Get-AzApplicationInsightsMyWorkbook.md | 21 +-
.../help/Get-AzApplicationInsightsWebTest.md | 25 +-
.../help/Get-AzApplicationInsightsWorkbook.md | 23 +-
...t-AzApplicationInsightsWorkbookRevision.md | 23 +-
...t-AzApplicationInsightsWorkbookTemplate.md | 19 +-
.../help/New-AzApplicationInsights.md | 17 +-
.../help/New-AzApplicationInsightsApiKey.md | 17 +-
...w-AzApplicationInsightsContinuousExport.md | 17 +-
...ApplicationInsightsLinkedStorageAccount.md | 17 +-
.../New-AzApplicationInsightsMyWorkbook.md | 17 +-
.../help/New-AzApplicationInsightsWebTest.md | 72 +++--
...icationInsightsWebTestGeolocationObject.md | 17 +-
...icationInsightsWebTestHeaderFieldObject.md | 17 +-
.../help/New-AzApplicationInsightsWorkbook.md | 17 +-
...w-AzApplicationInsightsWorkbookTemplate.md | 17 +-
...onInsightsWorkbookTemplateGalleryObject.md | 17 +-
.../help/Remove-AzApplicationInsights.md | 19 +-
.../Remove-AzApplicationInsightsApiKey.md | 19 +-
...e-AzApplicationInsightsContinuousExport.md | 19 +-
...ApplicationInsightsLinkedStorageAccount.md | 19 +-
.../Remove-AzApplicationInsightsMyWorkbook.md | 17 +-
.../Remove-AzApplicationInsightsWebTest.md | 19 +-
.../Remove-AzApplicationInsightsWorkbook.md | 19 +-
...e-AzApplicationInsightsWorkbookTemplate.md | 19 +-
...t-AzApplicationInsightsContinuousExport.md | 17 +-
.../help/Set-AzApplicationInsightsDailyCap.md | 17 +-
.../Set-AzApplicationInsightsPricingPlan.md | 17 +-
.../help/Update-AzApplicationInsights.md | 17 +-
...ApplicationInsightsLinkedStorageAccount.md | 19 +-
.../Update-AzApplicationInsightsMyWorkbook.md | 17 +-
.../Update-AzApplicationInsightsWebTestTag.md | 19 +-
.../Update-AzApplicationInsightsWorkbook.md | 19 +-
...e-AzApplicationInsightsWorkbookTemplate.md | 19 +-
98 files changed, 1586 insertions(+), 283 deletions(-)
create mode 100644 src/ApplicationInsights/ApplicationInsights.Autorest/utils/Get-SubscriptionIdTestSafe.ps1
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/examples/New-AzApplicationInsightsWebTest.md b/src/ApplicationInsights/ApplicationInsights.Autorest/examples/New-AzApplicationInsightsWebTest.md
index 70477cea48e9..54ca8cc11883 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/examples/New-AzApplicationInsightsWebTest.md
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/examples/New-AzApplicationInsightsWebTest.md
@@ -1,4 +1,4 @@
-### Example 1: Creates or updates an standard kind of the Application Insights web test
+### Example 1: Creates or updates a standard kind of the Application Insights web test
```powershell
$geoLocation = @()
$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "emea-nl-ams-azr"
@@ -8,6 +8,7 @@ New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name standar
-RequestUrl "https://www.bing.com" -RequestHttpVerb "GET" -TestName 'standard-pwsh01' `
-RuleExpectedHttpStatusCode 200 -Frequency 300 -Enabled -Timeout 120 -Kind 'standard' -RetryEnabled -GeoLocation $geoLocation
```
+
```output
Name Location WebTestKind ResourceGroupName Enabled
---- -------- ----------- ----------------- -------
@@ -18,7 +19,28 @@ This command creates or updates an standard kind of the Application Insights web
We enter hidden-link in the `Tag` parameter to associate WebTest and Application Insights.
-### Example 2: Creates or updates an ping kind of the Application Insights web test
+### Example 2: Creates or updates a standard kind of the Application Insights web test in disabled state
+```powershell
+$geoLocation = @()
+$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "emea-nl-ams-azr"
+$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "us-ca-sjc-azr"
+New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name standard-pwsh01 -Location 'westus2' `
+-Tag @{"hidden-link:/subscriptions/xxxxxxxxxx-xxxx-xxxxx-xxxxxxxxxxxx/resourceGroups/azpwsh-rg-test/providers/microsoft.insights/components/appinsights-portal01" = "Resource"} `
+-RequestUrl "https://www.bing.com" -RequestHttpVerb "GET" -TestName 'standard-pwsh01' `
+-RuleExpectedHttpStatusCode 200 -Frequency 300 -Enabled:$false -Timeout 120 -Kind 'standard' -RetryEnabled -GeoLocation $geoLocation
+```
+
+```output
+Name Location WebTestKind ResourceGroupName Enabled
+---- -------- ----------- ----------------- -------
+standard-pwsh01 westus2 standard azpwsh-rg-test False
+```
+
+This command creates or updates a standard kind of the Application Insights web test in disabled state.
+
+The switch parameter "-Enabled" must be set explicitly to $false to disable the test.
+
+### Example 3: Creates or updates a ping kind of the Application Insights web test
```powershell
$geoLocation = @()
$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "emea-nl-ams-azr"
@@ -29,6 +51,7 @@ New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name 'pingwe
-Kind 'ping' -RequestUrl 'https://cn.bing.com' -RequestParseDependent -RuleExpectedHttpStatusCode 200 `
-ContentMatch "status"
```
+
```output
Name Location WebTestKind ResourceGroupName Enabled
---- -------- ----------- ----------------- -------
@@ -37,7 +60,7 @@ pingwebtest-pwsh01 westus2 ping azpwsh-rg-test True
This command creates or updates an ping kind of the Application Insights web test.
-### Example 3: Creates or updates an ping kind of the Application Insights web test with custom configuration
+### Example 4: Creates or updates a ping kind of the Application Insights web test with custom configuration
```powershell
$geoLocation = @()
$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "emea-nl-ams-azr"
@@ -46,20 +69,20 @@ New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name 'pingwe
-Tag @{"hidden-link:/subscriptions/xxxxxxxxxx-xxxx-xxxxx-xxxxxxxxxxxx/resourceGroups/azpwsh-rg-test/providers/microsoft.insights/components/appinsights-portal01" = "Resource"} `
-GeoLocation $geoLocation -RetryEnabled -Enabled -Frequency 300 -Timeout 90 `
-Kind 'ping' `
--Configuration "
-
-
-
-
+-Configuration "
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
"
```
```output
@@ -69,4 +92,3 @@ pingwebtest-pwsh01 westus2 ping azpwsh-rg-test True
```
This command creates or updates an ping kind of the Application Insights web test with custom configuration.
-
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsights.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsights.ps1
index 9cb0f62e24d6..26bbb080bc87 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsights.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsights.ps1
@@ -180,7 +180,13 @@ begin {
GetByInputObject = 'Az.ApplicationInsights.custom\Get-AzApplicationInsights';
}
if (('ListBySubscription', 'ListByResourceGroupName', 'Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsApiKey.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsApiKey.ps1
index a9cf7f4f2c8a..ca515b253d58 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsApiKey.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsApiKey.ps1
@@ -171,7 +171,13 @@ begin {
List = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsApiKey_List';
}
if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsContinuousExport.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsContinuousExport.ps1
index f53bd3805c42..60f8bcbb0b63 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsContinuousExport.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsContinuousExport.ps1
@@ -171,7 +171,13 @@ begin {
List = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsContinuousExport_List';
}
if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsLinkedStorageAccount.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsLinkedStorageAccount.ps1
index 0b1704bec4fa..8182b299af64 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsLinkedStorageAccount.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsLinkedStorageAccount.ps1
@@ -158,7 +158,13 @@ begin {
GetViaIdentity = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsLinkedStorageAccount_GetViaIdentity';
}
if (('Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsMyWorkbook.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsMyWorkbook.ps1
index 1fcd70e056ce..3fd4639d3989 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsMyWorkbook.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsMyWorkbook.ps1
@@ -166,7 +166,13 @@ begin {
List1 = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsMyWorkbook_List1';
}
if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsWebTest.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsWebTest.ps1
index 449baa2645de..783a7440f496 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsWebTest.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsWebTest.ps1
@@ -187,7 +187,13 @@ begin {
List2 = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsWebTest_List2';
}
if (('Get', 'List', 'List1', 'List2') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsWorkbook.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsWorkbook.ps1
index 8b3fa3336bf0..2ef55b862f45 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsWorkbook.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsWorkbook.ps1
@@ -198,7 +198,13 @@ begin {
List1 = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsWorkbook_List1';
}
if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsWorkbookRevision.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsWorkbookRevision.ps1
index 851586f56249..0a0a071e4450 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsWorkbookRevision.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsWorkbookRevision.ps1
@@ -171,7 +171,13 @@ begin {
List = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsWorkbookRevision_List';
}
if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsWorkbookTemplate.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsWorkbookTemplate.ps1
index 63cbbb52d0e1..996d6fb184f8 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsWorkbookTemplate.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Get-AzApplicationInsightsWorkbookTemplate.ps1
@@ -188,7 +188,13 @@ begin {
GetViaIdentity = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsWorkbookTemplate_GetViaIdentity';
}
if (('Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsights.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsights.ps1
index ef345f559fe1..211e444b6cd6 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsights.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsights.ps1
@@ -253,7 +253,13 @@ begin {
__AllParameterSets = 'Az.ApplicationInsights.custom\New-AzApplicationInsights';
}
if (('__AllParameterSets') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsApiKey.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsApiKey.ps1
index 87ad45af8c82..8058f00987b6 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsApiKey.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsApiKey.ps1
@@ -145,7 +145,13 @@ begin {
ComponentNameParameterSet = 'Az.ApplicationInsights.custom\New-AzApplicationInsightsApiKey';
}
if (('ComponentNameParameterSet') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsContinuousExport.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsContinuousExport.ps1
index 4df088f915ea..bf6722338979 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsContinuousExport.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsContinuousExport.ps1
@@ -178,7 +178,13 @@ begin {
CreateExpanded = 'Az.ApplicationInsights.custom\New-AzApplicationInsightsContinuousExport';
}
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsLinkedStorageAccount.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsLinkedStorageAccount.ps1
index a2b298fd66dc..48e7d613b552 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsLinkedStorageAccount.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsLinkedStorageAccount.ps1
@@ -137,7 +137,13 @@ begin {
CreateExpanded = 'Az.ApplicationInsights.private\New-AzApplicationInsightsLinkedStorageAccount_CreateExpanded';
}
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsMyWorkbook.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsMyWorkbook.ps1
index a74ad3ea2d9a..56a71b2e01c5 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsMyWorkbook.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsMyWorkbook.ps1
@@ -220,7 +220,13 @@ begin {
CreateExpanded = 'Az.ApplicationInsights.private\New-AzApplicationInsightsMyWorkbook_CreateExpanded';
}
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('Kind')) {
$PSBoundParameters['Kind'] = "user"
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsWebTest.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsWebTest.ps1
index 11327de8d30b..b60a60889443 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsWebTest.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsWebTest.ps1
@@ -31,6 +31,14 @@ New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name standar
$geoLocation = @()
$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "emea-nl-ams-azr"
$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "us-ca-sjc-azr"
+New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name standard-pwsh01 -Location 'westus2' `
+-Tag @{"hidden-link:/subscriptions/xxxxxxxxxx-xxxx-xxxxx-xxxxxxxxxxxx/resourceGroups/azpwsh-rg-test/providers/microsoft.insights/components/appinsights-portal01" = "Resource"} `
+-RequestUrl "https://www.bing.com" -RequestHttpVerb "GET" -TestName 'standard-pwsh01' `
+-RuleExpectedHttpStatusCode 200 -Frequency 300 -Enabled:$false -Timeout 120 -Kind 'standard' -RetryEnabled -GeoLocation $geoLocation
+.Example
+$geoLocation = @()
+$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "emea-nl-ams-azr"
+$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "us-ca-sjc-azr"
New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name 'pingwebtest-pwsh01' -TestName 'pingwentest-pwsh01testname' -Location 'westus2' `
-Tag @{"hidden-link:/subscriptions/xxxxxxxxxx-xxxx-xxxxx-xxxxxxxxxxxx/resourceGroups/azpwsh-rg-test/providers/microsoft.insights/components/appinsights-portal01" = "Resource"} `
-GeoLocation $geoLocation -RetryEnabled -Enabled -Frequency 300 -Timeout 90 `
@@ -44,20 +52,20 @@ New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name 'pingwe
-Tag @{"hidden-link:/subscriptions/xxxxxxxxxx-xxxx-xxxxx-xxxxxxxxxxxx/resourceGroups/azpwsh-rg-test/providers/microsoft.insights/components/appinsights-portal01" = "Resource"} `
-GeoLocation $geoLocation -RetryEnabled -Enabled -Frequency 300 -Timeout 90 `
-Kind 'ping' `
--Configuration "
-
-
-
-
+-Configuration "
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
"
.Outputs
@@ -334,7 +342,13 @@ begin {
CreateClassic = 'Az.ApplicationInsights.custom\New-AzApplicationInsightsWebTest';
}
if (('CreateStandard', 'CreateClassic') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsWorkbook.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsWorkbook.ps1
index 82097e43dedf..86e665788bb9 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsWorkbook.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsWorkbook.ps1
@@ -221,7 +221,13 @@ begin {
CreateExpanded = 'Az.ApplicationInsights.private\New-AzApplicationInsightsWorkbook_CreateExpanded';
}
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('Kind')) {
$PSBoundParameters['Kind'] = "shared"
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsWorkbookTemplate.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsWorkbookTemplate.ps1
index 820119bbe860..7567cd0e5cdb 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsWorkbookTemplate.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/New-AzApplicationInsightsWorkbookTemplate.ps1
@@ -217,7 +217,13 @@ begin {
CreateExpanded = 'Az.ApplicationInsights.private\New-AzApplicationInsightsWorkbookTemplate_CreateExpanded';
}
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/ProxyCmdletDefinitions.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/ProxyCmdletDefinitions.ps1
index 7c8deca0060e..e4bed79b6744 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/ProxyCmdletDefinitions.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/ProxyCmdletDefinitions.ps1
@@ -171,7 +171,13 @@ begin {
List = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsApiKey_List';
}
if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -380,7 +386,13 @@ begin {
List = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsContinuousExport_List';
}
if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -576,7 +588,13 @@ begin {
GetViaIdentity = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsLinkedStorageAccount_GetViaIdentity';
}
if (('Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -780,7 +798,13 @@ begin {
List1 = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsMyWorkbook_List1';
}
if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -1005,7 +1029,13 @@ begin {
List2 = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsWebTest_List2';
}
if (('Get', 'List', 'List1', 'List2') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -1214,7 +1244,13 @@ begin {
List = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsWorkbookRevision_List';
}
if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -1440,7 +1476,13 @@ begin {
GetViaIdentity = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsWorkbookTemplate_GetViaIdentity';
}
if (('Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -1676,7 +1718,13 @@ begin {
List1 = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsWorkbook_List1';
}
if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -1851,7 +1899,13 @@ begin {
CreateExpanded = 'Az.ApplicationInsights.private\New-AzApplicationInsightsLinkedStorageAccount_CreateExpanded';
}
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -2109,7 +2163,13 @@ begin {
CreateExpanded = 'Az.ApplicationInsights.private\New-AzApplicationInsightsMyWorkbook_CreateExpanded';
}
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('Kind')) {
$PSBoundParameters['Kind'] = "user"
@@ -2367,7 +2427,13 @@ begin {
CreateExpanded = 'Az.ApplicationInsights.private\New-AzApplicationInsightsWorkbookTemplate_CreateExpanded';
}
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -2626,7 +2692,13 @@ begin {
CreateExpanded = 'Az.ApplicationInsights.private\New-AzApplicationInsightsWorkbook_CreateExpanded';
}
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('Kind')) {
$PSBoundParameters['Kind'] = "shared"
@@ -2832,7 +2904,13 @@ begin {
DeleteViaIdentity = 'Az.ApplicationInsights.private\Remove-AzApplicationInsightsApiKey_DeleteViaIdentity';
}
if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -3035,7 +3113,13 @@ begin {
DeleteViaIdentity = 'Az.ApplicationInsights.private\Remove-AzApplicationInsightsContinuousExport_DeleteViaIdentity';
}
if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -3237,7 +3321,13 @@ begin {
DeleteViaIdentity = 'Az.ApplicationInsights.private\Remove-AzApplicationInsightsLinkedStorageAccount_DeleteViaIdentity';
}
if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -3410,7 +3500,13 @@ begin {
Delete = 'Az.ApplicationInsights.private\Remove-AzApplicationInsightsMyWorkbook_Delete';
}
if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -3614,7 +3710,13 @@ begin {
DeleteViaIdentity = 'Az.ApplicationInsights.private\Remove-AzApplicationInsightsWebTest_DeleteViaIdentity';
}
if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -3817,7 +3919,13 @@ begin {
DeleteViaIdentity = 'Az.ApplicationInsights.private\Remove-AzApplicationInsightsWorkbookTemplate_DeleteViaIdentity';
}
if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -4020,7 +4128,13 @@ begin {
DeleteViaIdentity = 'Az.ApplicationInsights.private\Remove-AzApplicationInsightsWorkbook_DeleteViaIdentity';
}
if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -4222,7 +4336,13 @@ begin {
DeleteViaIdentity = 'Az.ApplicationInsights.private\Remove-AzApplicationInsights_DeleteViaIdentity';
}
if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -4425,7 +4545,13 @@ begin {
UpdateViaIdentityExpanded = 'Az.ApplicationInsights.private\Update-AzApplicationInsightsLinkedStorageAccount_UpdateViaIdentityExpanded';
}
if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -4638,7 +4764,13 @@ begin {
Update = 'Az.ApplicationInsights.private\Update-AzApplicationInsightsMyWorkbook_Update';
}
if (('Update') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -4842,7 +4974,13 @@ begin {
UpdateViaIdentityExpanded = 'Az.ApplicationInsights.private\Update-AzApplicationInsightsWebTestTag_UpdateViaIdentityExpanded';
}
if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -5089,7 +5227,13 @@ begin {
UpdateViaIdentityExpanded = 'Az.ApplicationInsights.private\Update-AzApplicationInsightsWorkbookTemplate_UpdateViaIdentityExpanded';
}
if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -5337,7 +5481,13 @@ begin {
UpdateViaIdentityExpanded = 'Az.ApplicationInsights.private\Update-AzApplicationInsightsWorkbook_UpdateViaIdentityExpanded';
}
if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
if (('UpdateExpanded', 'UpdateViaIdentityExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('Kind')) {
$PSBoundParameters['Kind'] = "shared"
@@ -5558,7 +5708,13 @@ begin {
GetByInputObject = 'Az.ApplicationInsights.custom\Get-AzApplicationInsights';
}
if (('ListBySubscription', 'ListByResourceGroupName', 'Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -5849,7 +6005,13 @@ begin {
__AllParameterSets = 'Az.ApplicationInsights.custom\New-AzApplicationInsights';
}
if (('__AllParameterSets') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -6032,7 +6194,13 @@ begin {
ComponentNameParameterSet = 'Az.ApplicationInsights.custom\New-AzApplicationInsightsApiKey';
}
if (('ComponentNameParameterSet') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -6248,7 +6416,13 @@ begin {
CreateExpanded = 'Az.ApplicationInsights.custom\New-AzApplicationInsightsContinuousExport';
}
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -6317,6 +6491,14 @@ New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name standar
$geoLocation = @()
$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "emea-nl-ams-azr"
$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "us-ca-sjc-azr"
+New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name standard-pwsh01 -Location 'westus2' `
+-Tag @{"hidden-link:/subscriptions/xxxxxxxxxx-xxxx-xxxxx-xxxxxxxxxxxx/resourceGroups/azpwsh-rg-test/providers/microsoft.insights/components/appinsights-portal01" = "Resource"} `
+-RequestUrl "https://www.bing.com" -RequestHttpVerb "GET" -TestName 'standard-pwsh01' `
+-RuleExpectedHttpStatusCode 200 -Frequency 300 -Enabled:$false -Timeout 120 -Kind 'standard' -RetryEnabled -GeoLocation $geoLocation
+.Example
+$geoLocation = @()
+$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "emea-nl-ams-azr"
+$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "us-ca-sjc-azr"
New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name 'pingwebtest-pwsh01' -TestName 'pingwentest-pwsh01testname' -Location 'westus2' `
-Tag @{"hidden-link:/subscriptions/xxxxxxxxxx-xxxx-xxxxx-xxxxxxxxxxxx/resourceGroups/azpwsh-rg-test/providers/microsoft.insights/components/appinsights-portal01" = "Resource"} `
-GeoLocation $geoLocation -RetryEnabled -Enabled -Frequency 300 -Timeout 90 `
@@ -6330,20 +6512,20 @@ New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name 'pingwe
-Tag @{"hidden-link:/subscriptions/xxxxxxxxxx-xxxx-xxxxx-xxxxxxxxxxxx/resourceGroups/azpwsh-rg-test/providers/microsoft.insights/components/appinsights-portal01" = "Resource"} `
-GeoLocation $geoLocation -RetryEnabled -Enabled -Frequency 300 -Timeout 90 `
-Kind 'ping' `
--Configuration "
-
-
-
-
+-Configuration "
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
"
.Outputs
@@ -6620,7 +6802,13 @@ begin {
CreateClassic = 'Az.ApplicationInsights.custom\New-AzApplicationInsightsWebTest';
}
if (('CreateStandard', 'CreateClassic') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -7184,7 +7372,13 @@ begin {
CreateExpanded = 'Az.ApplicationInsights.custom\Set-AzApplicationInsightsContinuousExport';
}
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -7363,7 +7557,13 @@ begin {
UpdateExpanded = 'Az.ApplicationInsights.custom\Set-AzApplicationInsightsDailyCap';
}
if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -7550,7 +7750,13 @@ begin {
UpdateExpanded = 'Az.ApplicationInsights.custom\Set-AzApplicationInsightsPricingPlan';
}
if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -7827,7 +8033,13 @@ begin {
__AllParameterSets = 'Az.ApplicationInsights.custom\Update-AzApplicationInsights';
}
if (('__AllParameterSets') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsights.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsights.ps1
index 8675af66ed18..6bfcbbfdb7ec 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsights.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsights.ps1
@@ -164,7 +164,13 @@ begin {
DeleteViaIdentity = 'Az.ApplicationInsights.private\Remove-AzApplicationInsights_DeleteViaIdentity';
}
if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsApiKey.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsApiKey.ps1
index b9263da06f1f..2342246ec383 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsApiKey.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsApiKey.ps1
@@ -165,7 +165,13 @@ begin {
DeleteViaIdentity = 'Az.ApplicationInsights.private\Remove-AzApplicationInsightsApiKey_DeleteViaIdentity';
}
if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsContinuousExport.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsContinuousExport.ps1
index e8094b34cd52..e53b2ca8fa9e 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsContinuousExport.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsContinuousExport.ps1
@@ -165,7 +165,13 @@ begin {
DeleteViaIdentity = 'Az.ApplicationInsights.private\Remove-AzApplicationInsightsContinuousExport_DeleteViaIdentity';
}
if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsLinkedStorageAccount.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsLinkedStorageAccount.ps1
index 4cb606291ad8..79b82224ddd5 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsLinkedStorageAccount.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsLinkedStorageAccount.ps1
@@ -164,7 +164,13 @@ begin {
DeleteViaIdentity = 'Az.ApplicationInsights.private\Remove-AzApplicationInsightsLinkedStorageAccount_DeleteViaIdentity';
}
if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsMyWorkbook.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsMyWorkbook.ps1
index ca180865188f..86514fb3d22d 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsMyWorkbook.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsMyWorkbook.ps1
@@ -135,7 +135,13 @@ begin {
Delete = 'Az.ApplicationInsights.private\Remove-AzApplicationInsightsMyWorkbook_Delete';
}
if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsWebTest.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsWebTest.ps1
index 8538f92d12bd..b37448ab9d50 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsWebTest.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsWebTest.ps1
@@ -166,7 +166,13 @@ begin {
DeleteViaIdentity = 'Az.ApplicationInsights.private\Remove-AzApplicationInsightsWebTest_DeleteViaIdentity';
}
if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsWorkbook.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsWorkbook.ps1
index 83d4cc36f401..771d059f6269 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsWorkbook.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsWorkbook.ps1
@@ -165,7 +165,13 @@ begin {
DeleteViaIdentity = 'Az.ApplicationInsights.private\Remove-AzApplicationInsightsWorkbook_DeleteViaIdentity';
}
if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsWorkbookTemplate.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsWorkbookTemplate.ps1
index 11bc3dd8574c..fe675ee9e55c 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsWorkbookTemplate.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Remove-AzApplicationInsightsWorkbookTemplate.ps1
@@ -165,7 +165,13 @@ begin {
DeleteViaIdentity = 'Az.ApplicationInsights.private\Remove-AzApplicationInsightsWorkbookTemplate_DeleteViaIdentity';
}
if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Set-AzApplicationInsightsContinuousExport.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Set-AzApplicationInsightsContinuousExport.ps1
index ce543d8828b7..ce2b4cbf6520 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Set-AzApplicationInsightsContinuousExport.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Set-AzApplicationInsightsContinuousExport.ps1
@@ -190,7 +190,13 @@ begin {
CreateExpanded = 'Az.ApplicationInsights.custom\Set-AzApplicationInsightsContinuousExport';
}
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Set-AzApplicationInsightsDailyCap.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Set-AzApplicationInsightsDailyCap.ps1
index 58c19dd48c10..f971715c9646 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Set-AzApplicationInsightsDailyCap.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Set-AzApplicationInsightsDailyCap.ps1
@@ -141,7 +141,13 @@ begin {
UpdateExpanded = 'Az.ApplicationInsights.custom\Set-AzApplicationInsightsDailyCap';
}
if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Set-AzApplicationInsightsPricingPlan.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Set-AzApplicationInsightsPricingPlan.ps1
index feef636ad1ae..8c87b0d4f736 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Set-AzApplicationInsightsPricingPlan.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Set-AzApplicationInsightsPricingPlan.ps1
@@ -149,7 +149,13 @@ begin {
UpdateExpanded = 'Az.ApplicationInsights.custom\Set-AzApplicationInsightsPricingPlan';
}
if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Update-AzApplicationInsights.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Update-AzApplicationInsights.ps1
index 340b81e74997..d8e289c1c426 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Update-AzApplicationInsights.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Update-AzApplicationInsights.ps1
@@ -239,7 +239,13 @@ begin {
__AllParameterSets = 'Az.ApplicationInsights.custom\Update-AzApplicationInsights';
}
if (('__AllParameterSets') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Update-AzApplicationInsightsLinkedStorageAccount.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Update-AzApplicationInsightsLinkedStorageAccount.ps1
index d1dc06c07262..f0194a261221 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Update-AzApplicationInsightsLinkedStorageAccount.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Update-AzApplicationInsightsLinkedStorageAccount.ps1
@@ -165,7 +165,13 @@ begin {
UpdateViaIdentityExpanded = 'Az.ApplicationInsights.private\Update-AzApplicationInsightsLinkedStorageAccount_UpdateViaIdentityExpanded';
}
if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Update-AzApplicationInsightsMyWorkbook.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Update-AzApplicationInsightsMyWorkbook.ps1
index c20a248120b0..b9f2df99c25a 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Update-AzApplicationInsightsMyWorkbook.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Update-AzApplicationInsightsMyWorkbook.ps1
@@ -175,7 +175,13 @@ begin {
Update = 'Az.ApplicationInsights.private\Update-AzApplicationInsightsMyWorkbook_Update';
}
if (('Update') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Update-AzApplicationInsightsWebTestTag.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Update-AzApplicationInsightsWebTestTag.ps1
index c616e38930ee..fce384196790 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Update-AzApplicationInsightsWebTestTag.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Update-AzApplicationInsightsWebTestTag.ps1
@@ -166,7 +166,13 @@ begin {
UpdateViaIdentityExpanded = 'Az.ApplicationInsights.private\Update-AzApplicationInsightsWebTestTag_UpdateViaIdentityExpanded';
}
if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Update-AzApplicationInsightsWorkbook.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Update-AzApplicationInsightsWorkbook.ps1
index 7c411430b626..4a3256d83e93 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Update-AzApplicationInsightsWorkbook.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Update-AzApplicationInsightsWorkbook.ps1
@@ -210,7 +210,13 @@ begin {
UpdateViaIdentityExpanded = 'Az.ApplicationInsights.private\Update-AzApplicationInsightsWorkbook_UpdateViaIdentityExpanded';
}
if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
if (('UpdateExpanded', 'UpdateViaIdentityExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('Kind')) {
$PSBoundParameters['Kind'] = "shared"
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Update-AzApplicationInsightsWorkbookTemplate.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Update-AzApplicationInsightsWorkbookTemplate.ps1
index 7bf2f3274204..f24c438c6a04 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Update-AzApplicationInsightsWorkbookTemplate.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/exports/Update-AzApplicationInsightsWorkbookTemplate.ps1
@@ -209,7 +209,13 @@ begin {
UpdateViaIdentityExpanded = 'Az.ApplicationInsights.private\Update-AzApplicationInsightsWorkbookTemplate_UpdateViaIdentityExpanded';
}
if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
[Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs b/src/ApplicationInsights/ApplicationInsights.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs
index d08052909fcc..d89313cb052b 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs
@@ -269,9 +269,26 @@ private string GetDefaultValuesStatements()
var variantListString = defaultInfo.ParameterGroup.VariantNames.ToPsList();
var parameterName = defaultInfo.ParameterGroup.ParameterName;
sb.AppendLine();
- sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}')) {{");
- sb.AppendLine($"{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = {defaultInfo.Script}");
- sb.Append($"{Indent}{Indent}}}");
+ //Yabo: this is bad to hard code the subscription id, but autorest load input README.md reversely (entry readme -> required readme), there are no other way to
+ //override default value set in required readme
+ if ("SubscriptionId".Equals(parameterName))
+ {
+ sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}')) {{");
+ sb.AppendLine($"{Indent}{Indent}{Indent}$testPlayback = $false");
+ sb.AppendLine($"{Indent}{Indent}{Indent}$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object {{ $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }}");
+ sb.AppendLine($"{Indent}{Indent}{Indent}if ($testPlayback) {{");
+ sb.AppendLine($"{Indent}{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')");
+ sb.AppendLine($"{Indent}{Indent}{Indent}}} else {{");
+ sb.AppendLine($"{Indent}{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = {defaultInfo.Script}");
+ sb.AppendLine($"{Indent}{Indent}{Indent}}}");
+ sb.Append($"{Indent}{Indent}}}");
+ }
+ else
+ {
+ sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}')) {{");
+ sb.AppendLine($"{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = {defaultInfo.Script}");
+ sb.Append($"{Indent}{Indent}}}");
+ }
}
return sb.ToString();
}
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/help/New-AzApplicationInsightsWebTest.md b/src/ApplicationInsights/ApplicationInsights.Autorest/help/New-AzApplicationInsightsWebTest.md
index 7d262727c6e5..6ec2bf8125e6 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/help/New-AzApplicationInsightsWebTest.md
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/help/New-AzApplicationInsightsWebTest.md
@@ -39,7 +39,7 @@ Creates or updates an Application Insights web test definition.
## EXAMPLES
-### Example 1: Creates or updates an standard kind of the Application Insights web test
+### Example 1: Creates or updates a standard kind of the Application Insights web test
```powershell
$geoLocation = @()
$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "emea-nl-ams-azr"
@@ -60,7 +60,28 @@ This command creates or updates an standard kind of the Application Insights web
We enter hidden-link in the `Tag` parameter to associate WebTest and Application Insights.
-### Example 2: Creates or updates an ping kind of the Application Insights web test
+### Example 2: Creates or updates a standard kind of the Application Insights web test in disabled state
+```powershell
+$geoLocation = @()
+$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "emea-nl-ams-azr"
+$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "us-ca-sjc-azr"
+New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name standard-pwsh01 -Location 'westus2' `
+-Tag @{"hidden-link:/subscriptions/xxxxxxxxxx-xxxx-xxxxx-xxxxxxxxxxxx/resourceGroups/azpwsh-rg-test/providers/microsoft.insights/components/appinsights-portal01" = "Resource"} `
+-RequestUrl "https://www.bing.com" -RequestHttpVerb "GET" -TestName 'standard-pwsh01' `
+-RuleExpectedHttpStatusCode 200 -Frequency 300 -Enabled:$false -Timeout 120 -Kind 'standard' -RetryEnabled -GeoLocation $geoLocation
+```
+
+```output
+Name Location WebTestKind ResourceGroupName Enabled
+---- -------- ----------- ----------------- -------
+standard-pwsh01 westus2 standard azpwsh-rg-test False
+```
+
+This command creates or updates a standard kind of the Application Insights web test in disabled state.
+
+The switch parameter "-Enabled" must be set explicitly to $false to disable the test.
+
+### Example 3: Creates or updates a ping kind of the Application Insights web test
```powershell
$geoLocation = @()
$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "emea-nl-ams-azr"
@@ -80,7 +101,7 @@ pingwebtest-pwsh01 westus2 ping azpwsh-rg-test True
This command creates or updates an ping kind of the Application Insights web test.
-### Example 3: Creates or updates an ping kind of the Application Insights web test with custom configuration
+### Example 4: Creates or updates a ping kind of the Application Insights web test with custom configuration
```powershell
$geoLocation = @()
$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "emea-nl-ams-azr"
@@ -89,20 +110,20 @@ New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name 'pingwe
-Tag @{"hidden-link:/subscriptions/xxxxxxxxxx-xxxx-xxxxx-xxxxxxxxxxxx/resourceGroups/azpwsh-rg-test/providers/microsoft.insights/components/appinsights-portal01" = "Resource"} `
-GeoLocation $geoLocation -RetryEnabled -Enabled -Frequency 300 -Timeout 90 `
-Kind 'ping' `
--Configuration "
-
-
-
-
+-Configuration "
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
"
```
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Clear-AzApplicationInsights.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Clear-AzApplicationInsights.ps1
index 1bc74f8452fa..dfe643a80983 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Clear-AzApplicationInsights.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Clear-AzApplicationInsights.ps1
@@ -195,7 +195,13 @@ begin {
PurgeViaIdentityExpanded = 'Az.ApplicationInsights.private\Clear-AzApplicationInsights_PurgeViaIdentityExpanded';
}
if (('Purge', 'PurgeExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsights.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsights.ps1
index 0b821e859b71..3e3c6c2f25ae 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsights.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsights.ps1
@@ -148,7 +148,13 @@ begin {
List1 = 'Az.ApplicationInsights.private\Get-AzApplicationInsights_List1';
}
if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsightsAnnotation.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsightsAnnotation.ps1
index 68413cab53b4..78838ed8ca2d 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsightsAnnotation.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsightsAnnotation.ps1
@@ -166,7 +166,13 @@ begin {
List = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsAnnotation_List';
}
if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsightsComponentAvailableFeature.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsightsComponentAvailableFeature.ps1
index a44551900cbd..3eac263af1de 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsightsComponentAvailableFeature.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsightsComponentAvailableFeature.ps1
@@ -143,7 +143,13 @@ begin {
GetViaIdentity = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsComponentAvailableFeature_GetViaIdentity';
}
if (('Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsightsComponentCurrentBillingFeature.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsightsComponentCurrentBillingFeature.ps1
index 1ed42f2444ec..c0ce21ed3107 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsightsComponentCurrentBillingFeature.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsightsComponentCurrentBillingFeature.ps1
@@ -143,7 +143,13 @@ begin {
GetViaIdentity = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsComponentCurrentBillingFeature_GetViaIdentity';
}
if (('Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsightsComponentFeatureCapability.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsightsComponentFeatureCapability.ps1
index 56c3415f9a87..f8ea6ace7737 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsightsComponentFeatureCapability.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsightsComponentFeatureCapability.ps1
@@ -143,7 +143,13 @@ begin {
GetViaIdentity = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsComponentFeatureCapability_GetViaIdentity';
}
if (('Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsightsComponentPurgeStatus.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsightsComponentPurgeStatus.ps1
index fd01f39fb6dc..9d801c2429cb 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsightsComponentPurgeStatus.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsightsComponentPurgeStatus.ps1
@@ -149,7 +149,13 @@ begin {
GetViaIdentity = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsComponentPurgeStatus_GetViaIdentity';
}
if (('Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsightsComponentQuotaStatus.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsightsComponentQuotaStatus.ps1
index 97671f35642c..efa66e8cc1a8 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsightsComponentQuotaStatus.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Get-AzApplicationInsightsComponentQuotaStatus.ps1
@@ -143,7 +143,13 @@ begin {
GetViaIdentity = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsComponentQuotaStatus_GetViaIdentity';
}
if (('Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/New-AzApplicationInsights.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/New-AzApplicationInsights.ps1
index d12814bc4672..32653e75c438 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/New-AzApplicationInsights.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/New-AzApplicationInsights.ps1
@@ -318,7 +318,13 @@ begin {
CreateViaIdentityExpanded = 'Az.ApplicationInsights.private\New-AzApplicationInsights_CreateViaIdentityExpanded';
}
if (('Create', 'CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/New-AzApplicationInsightsAnnotation.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/New-AzApplicationInsightsAnnotation.ps1
index 5242f9b3d92a..d3b66b9b01bf 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/New-AzApplicationInsightsAnnotation.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/New-AzApplicationInsightsAnnotation.ps1
@@ -208,7 +208,13 @@ begin {
CreateViaIdentityExpanded = 'Az.ApplicationInsights.private\New-AzApplicationInsightsAnnotation_CreateViaIdentityExpanded';
}
if (('Create', 'CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/New-AzApplicationInsightsApiKey.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/New-AzApplicationInsightsApiKey.ps1
index 567498c1b9d1..7044def6e04d 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/New-AzApplicationInsightsApiKey.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/New-AzApplicationInsightsApiKey.ps1
@@ -136,7 +136,13 @@ begin {
CreateExpanded = 'Az.ApplicationInsights.private\New-AzApplicationInsightsApiKey_CreateExpanded';
}
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/New-AzApplicationInsightsContinuousExport.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/New-AzApplicationInsightsContinuousExport.ps1
index 6c109f0d57df..77a230748689 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/New-AzApplicationInsightsContinuousExport.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/New-AzApplicationInsightsContinuousExport.ps1
@@ -238,7 +238,13 @@ begin {
CreateViaIdentityExpanded = 'Az.ApplicationInsights.private\New-AzApplicationInsightsContinuousExport_CreateViaIdentityExpanded';
}
if (('Create', 'CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/New-AzApplicationInsightsWebTest.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/New-AzApplicationInsightsWebTest.ps1
index 92d46600a7cc..a0f2ff27bf2f 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/New-AzApplicationInsightsWebTest.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/New-AzApplicationInsightsWebTest.ps1
@@ -31,6 +31,14 @@ New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name standar
$geoLocation = @()
$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "emea-nl-ams-azr"
$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "us-ca-sjc-azr"
+New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name standard-pwsh01 -Location 'westus2' `
+-Tag @{"hidden-link:/subscriptions/xxxxxxxxxx-xxxx-xxxxx-xxxxxxxxxxxx/resourceGroups/azpwsh-rg-test/providers/microsoft.insights/components/appinsights-portal01" = "Resource"} `
+-RequestUrl "https://www.bing.com" -RequestHttpVerb "GET" -TestName 'standard-pwsh01' `
+-RuleExpectedHttpStatusCode 200 -Frequency 300 -Enabled:$false -Timeout 120 -Kind 'standard' -RetryEnabled -GeoLocation $geoLocation
+.Example
+$geoLocation = @()
+$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "emea-nl-ams-azr"
+$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "us-ca-sjc-azr"
New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name 'pingwebtest-pwsh01' -TestName 'pingwentest-pwsh01testname' -Location 'westus2' `
-Tag @{"hidden-link:/subscriptions/xxxxxxxxxx-xxxx-xxxxx-xxxxxxxxxxxx/resourceGroups/azpwsh-rg-test/providers/microsoft.insights/components/appinsights-portal01" = "Resource"} `
-GeoLocation $geoLocation -RetryEnabled -Enabled -Frequency 300 -Timeout 90 `
@@ -44,20 +52,20 @@ New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name 'pingwe
-Tag @{"hidden-link:/subscriptions/xxxxxxxxxx-xxxx-xxxxx-xxxxxxxxxxxx/resourceGroups/azpwsh-rg-test/providers/microsoft.insights/components/appinsights-portal01" = "Resource"} `
-GeoLocation $geoLocation -RetryEnabled -Enabled -Frequency 300 -Timeout 90 `
-Kind 'ping' `
--Configuration "
-
-
-
-
+-Configuration "
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
"
.Outputs
@@ -317,7 +325,13 @@ begin {
CreateExpanded = 'Az.ApplicationInsights.private\New-AzApplicationInsightsWebTest_CreateExpanded';
}
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/ProxyCmdletDefinitions.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/ProxyCmdletDefinitions.ps1
index 68e034aedf36..e8c7d276f1e8 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/ProxyCmdletDefinitions.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/ProxyCmdletDefinitions.ps1
@@ -195,7 +195,13 @@ begin {
PurgeViaIdentityExpanded = 'Az.ApplicationInsights.private\Clear-AzApplicationInsights_PurgeViaIdentityExpanded';
}
if (('Purge', 'PurgeExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
@@ -380,7 +386,13 @@ begin {
List = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsAnnotation_List';
}
if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
@@ -542,7 +554,13 @@ begin {
GetViaIdentity = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsComponentAvailableFeature_GetViaIdentity';
}
if (('Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
@@ -704,7 +722,13 @@ begin {
GetViaIdentity = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsComponentCurrentBillingFeature_GetViaIdentity';
}
if (('Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
@@ -866,7 +890,13 @@ begin {
GetViaIdentity = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsComponentFeatureCapability_GetViaIdentity';
}
if (('Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
@@ -1034,7 +1064,13 @@ begin {
GetViaIdentity = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsComponentPurgeStatus_GetViaIdentity';
}
if (('Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
@@ -1196,7 +1232,13 @@ begin {
GetViaIdentity = 'Az.ApplicationInsights.private\Get-AzApplicationInsightsComponentQuotaStatus_GetViaIdentity';
}
if (('Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
@@ -1473,7 +1515,13 @@ begin {
List1 = 'Az.ApplicationInsights.private\Get-AzApplicationInsights_List1';
}
if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
@@ -1700,7 +1748,13 @@ begin {
CreateViaIdentityExpanded = 'Az.ApplicationInsights.private\New-AzApplicationInsightsAnnotation_CreateViaIdentityExpanded';
}
if (('Create', 'CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
@@ -1855,7 +1909,13 @@ begin {
CreateExpanded = 'Az.ApplicationInsights.private\New-AzApplicationInsightsApiKey_CreateExpanded';
}
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
@@ -2112,7 +2172,13 @@ begin {
CreateViaIdentityExpanded = 'Az.ApplicationInsights.private\New-AzApplicationInsightsContinuousExport_CreateViaIdentityExpanded';
}
if (('Create', 'CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
@@ -2162,6 +2228,14 @@ New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name standar
$geoLocation = @()
$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "emea-nl-ams-azr"
$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "us-ca-sjc-azr"
+New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name standard-pwsh01 -Location 'westus2' `
+-Tag @{"hidden-link:/subscriptions/xxxxxxxxxx-xxxx-xxxxx-xxxxxxxxxxxx/resourceGroups/azpwsh-rg-test/providers/microsoft.insights/components/appinsights-portal01" = "Resource"} `
+-RequestUrl "https://www.bing.com" -RequestHttpVerb "GET" -TestName 'standard-pwsh01' `
+-RuleExpectedHttpStatusCode 200 -Frequency 300 -Enabled:$false -Timeout 120 -Kind 'standard' -RetryEnabled -GeoLocation $geoLocation
+.Example
+$geoLocation = @()
+$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "emea-nl-ams-azr"
+$geoLocation += New-AzApplicationInsightsWebTestGeolocationObject -Location "us-ca-sjc-azr"
New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name 'pingwebtest-pwsh01' -TestName 'pingwentest-pwsh01testname' -Location 'westus2' `
-Tag @{"hidden-link:/subscriptions/xxxxxxxxxx-xxxx-xxxxx-xxxxxxxxxxxx/resourceGroups/azpwsh-rg-test/providers/microsoft.insights/components/appinsights-portal01" = "Resource"} `
-GeoLocation $geoLocation -RetryEnabled -Enabled -Frequency 300 -Timeout 90 `
@@ -2175,20 +2249,20 @@ New-AzApplicationInsightsWebTest -ResourceGroupName azpwsh-rg-test -Name 'pingwe
-Tag @{"hidden-link:/subscriptions/xxxxxxxxxx-xxxx-xxxxx-xxxxxxxxxxxx/resourceGroups/azpwsh-rg-test/providers/microsoft.insights/components/appinsights-portal01" = "Resource"} `
-GeoLocation $geoLocation -RetryEnabled -Enabled -Frequency 300 -Timeout 90 `
-Kind 'ping' `
--Configuration "
-
-
-
-
+-Configuration "
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
"
.Outputs
@@ -2448,7 +2522,13 @@ begin {
CreateExpanded = 'Az.ApplicationInsights.private\New-AzApplicationInsightsWebTest_CreateExpanded';
}
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
@@ -2785,7 +2865,13 @@ begin {
CreateViaIdentityExpanded = 'Az.ApplicationInsights.private\New-AzApplicationInsights_CreateViaIdentityExpanded';
}
if (('Create', 'CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
@@ -2960,7 +3046,13 @@ begin {
DeleteViaIdentity = 'Az.ApplicationInsights.private\Remove-AzApplicationInsightsAnnotation_DeleteViaIdentity';
}
if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
@@ -3147,7 +3239,13 @@ begin {
UpdateExpanded = 'Az.ApplicationInsights.private\Set-AzApplicationInsightsComponentCurrentBillingFeature_UpdateExpanded';
}
if (('Update', 'UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
@@ -3372,7 +3470,13 @@ begin {
UpdateExpanded = 'Az.ApplicationInsights.private\Set-AzApplicationInsightsContinuousExport_UpdateExpanded';
}
if (('Update', 'UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
@@ -3663,7 +3767,13 @@ begin {
UpdateExpanded = 'Az.ApplicationInsights.private\Set-AzApplicationInsights_UpdateExpanded';
}
if (('Update', 'UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
@@ -3855,7 +3965,13 @@ begin {
UpdateViaIdentityExpanded = 'Az.ApplicationInsights.private\Update-AzApplicationInsightsComponentTag_UpdateViaIdentityExpanded';
}
if (('Update', 'UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Remove-AzApplicationInsightsAnnotation.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Remove-AzApplicationInsightsAnnotation.ps1
index 7d3bf224c817..aa5b21c9bf13 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Remove-AzApplicationInsightsAnnotation.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Remove-AzApplicationInsightsAnnotation.ps1
@@ -156,7 +156,13 @@ begin {
DeleteViaIdentity = 'Az.ApplicationInsights.private\Remove-AzApplicationInsightsAnnotation_DeleteViaIdentity';
}
if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Set-AzApplicationInsights.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Set-AzApplicationInsights.ps1
index 45fd210a04c2..28de5b255f89 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Set-AzApplicationInsights.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Set-AzApplicationInsights.ps1
@@ -272,7 +272,13 @@ begin {
UpdateExpanded = 'Az.ApplicationInsights.private\Set-AzApplicationInsights_UpdateExpanded';
}
if (('Update', 'UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Set-AzApplicationInsightsComponentCurrentBillingFeature.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Set-AzApplicationInsightsComponentCurrentBillingFeature.ps1
index 8e3f14369b5e..a036414787d1 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Set-AzApplicationInsightsComponentCurrentBillingFeature.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Set-AzApplicationInsightsComponentCurrentBillingFeature.ps1
@@ -168,7 +168,13 @@ begin {
UpdateExpanded = 'Az.ApplicationInsights.private\Set-AzApplicationInsightsComponentCurrentBillingFeature_UpdateExpanded';
}
if (('Update', 'UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Set-AzApplicationInsightsContinuousExport.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Set-AzApplicationInsightsContinuousExport.ps1
index 7ae01e1ed987..7f5084d77909 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Set-AzApplicationInsightsContinuousExport.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Set-AzApplicationInsightsContinuousExport.ps1
@@ -206,7 +206,13 @@ begin {
UpdateExpanded = 'Az.ApplicationInsights.private\Set-AzApplicationInsightsContinuousExport_UpdateExpanded';
}
if (('Update', 'UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Update-AzApplicationInsightsComponentTag.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Update-AzApplicationInsightsComponentTag.ps1
index 61c42f5e720e..19ad49b919b7 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Update-AzApplicationInsightsComponentTag.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/internal/Update-AzApplicationInsightsComponentTag.ps1
@@ -173,7 +173,13 @@ begin {
UpdateViaIdentityExpanded = 'Az.ApplicationInsights.private\Update-AzApplicationInsightsComponentTag_UpdateViaIdentityExpanded';
}
if (('Update', 'UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
- $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ $testPlayback = $false
+ $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
+ if ($testPlayback) {
+ $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
+ } else {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/test-module.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/test-module.ps1
index c967c094c554..c30d3a4568f8 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/test-module.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/test-module.ps1
@@ -74,13 +74,14 @@ try
if ($TestMode -ne 'playback')
{
setupEnv
+ } else {
+ $env:AzPSAutorestTestPlaybackMode = $true
}
$testFolder = Join-Path $PSScriptRoot 'test'
if ($null -ne $TestName)
{
Invoke-Pester -Script @{ Path = $testFolder } -TestName $TestName -ExcludeTag $ExcludeTag -EnableExit -OutputFile (Join-Path $testFolder "$moduleName-TestResults.xml")
- } else
- {
+ } else {
Invoke-Pester -Script @{ Path = $testFolder } -ExcludeTag $ExcludeTag -EnableExit -OutputFile (Join-Path $testFolder "$moduleName-TestResults.xml")
}
} Finally
@@ -89,6 +90,9 @@ try
{
cleanupEnv
}
+ else {
+ $env:AzPSAutorestTestPlaybackMode = ''
+ }
}
Write-Host -ForegroundColor Green '-------------Done-------------'
\ No newline at end of file
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/test/loadEnv.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/test/loadEnv.ps1
index 5f079e89615e..6a7c385c6b7d 100644
--- a/src/ApplicationInsights/ApplicationInsights.Autorest/test/loadEnv.ps1
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/test/loadEnv.ps1
@@ -25,5 +25,5 @@ if (Test-Path -Path (Join-Path $PSScriptRoot $envFile)) {
$env = @{}
if (Test-Path -Path $envFilePath) {
$env = Get-Content (Join-Path $PSScriptRoot $envFile) | ConvertFrom-Json
- $PSDefaultParameterValues=@{"*:SubscriptionId"=$env.SubscriptionId; "*:Tenant"=$env.Tenant}
+ $PSDefaultParameterValues=@{"*:Tenant"=$env.Tenant}
}
\ No newline at end of file
diff --git a/src/ApplicationInsights/ApplicationInsights.Autorest/utils/Get-SubscriptionIdTestSafe.ps1 b/src/ApplicationInsights/ApplicationInsights.Autorest/utils/Get-SubscriptionIdTestSafe.ps1
new file mode 100644
index 000000000000..5319862d3372
--- /dev/null
+++ b/src/ApplicationInsights/ApplicationInsights.Autorest/utils/Get-SubscriptionIdTestSafe.ps1
@@ -0,0 +1,7 @@
+param()
+if ($env:AzPSAutorestTestPlaybackMode) {
+ $loadEnvPath = Join-Path $PSScriptRoot '..' 'test' 'loadEnv.ps1'
+ . ($loadEnvPath)
+ return $env.SubscriptionId
+}
+return (Get-AzContext).Subscription.Id
\ No newline at end of file
diff --git a/src/ApplicationInsights/ApplicationInsights/Az.ApplicationInsights.psd1 b/src/ApplicationInsights/ApplicationInsights/Az.ApplicationInsights.psd1
index e2012a47039b..9b6369a26ee9 100644
--- a/src/ApplicationInsights/ApplicationInsights/Az.ApplicationInsights.psd1
+++ b/src/ApplicationInsights/ApplicationInsights/Az.ApplicationInsights.psd1
@@ -3,7 +3,7 @@
#
# Generated by: Microsoft Corporation
#
-# Generated on: 3/22/2024
+# Generated on: 3/26/2024
#
@{
diff --git a/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsights.md b/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsights.md
index 211b0dd59da8..870dd49bfb05 100644
--- a/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsights.md
+++ b/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsights.md
@@ -15,31 +15,31 @@ Returns an Application Insights component.
### ListBySubscription (Default)
```
Get-AzApplicationInsights [-SubscriptionId ] [-DefaultProfile ]
- []
+ [-ProgressAction ] []
```
### Get
```
Get-AzApplicationInsights [-SubscriptionId ] -ResourceGroupName -Name [-Full]
- [-DefaultProfile ] []
+ [-DefaultProfile ] [-ProgressAction ] []
```
### ListByResourceGroupName
```
Get-AzApplicationInsights [-SubscriptionId ] -ResourceGroupName [-DefaultProfile ]
- []
+ [-ProgressAction ] []
```
### GetByResourceId
```
Get-AzApplicationInsights -ResourceId [-Full] [-DefaultProfile ]
- []
+ [-ProgressAction ] []
```
### GetByInputObject
```
Get-AzApplicationInsights -InputObject [-DefaultProfile ]
- []
+ [-ProgressAction ] []
```
## DESCRIPTION
@@ -123,6 +123,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```
+### -ProgressAction
+{{ Fill ProgressAction Description }}
+
+```yaml
+Type: System.Management.Automation.ActionPreference
+Parameter Sets: (All)
+Aliases: proga
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
### -ResourceGroupName
The name of the resource group.
The name is case insensitive.
diff --git a/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsApiKey.md b/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsApiKey.md
index 8097d4e85595..d7a0dc8cd435 100644
--- a/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsApiKey.md
+++ b/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsApiKey.md
@@ -15,20 +15,20 @@ Get the API Key for this key id.
### List (Default)
```
Get-AzApplicationInsightsApiKey -Name -ResourceGroupName [-SubscriptionId ]
- [-DefaultProfile ] []
+ [-DefaultProfile ] [-ProgressAction ] []
```
### Get
```
Get-AzApplicationInsightsApiKey -ApiKeyId -Name -ResourceGroupName
- [-SubscriptionId ] [-DefaultProfile ]
+ [-SubscriptionId ] [-DefaultProfile ] [-ProgressAction ]
[]
```
### GetViaIdentity
```
Get-AzApplicationInsightsApiKey -InputObject [-DefaultProfile ]
- []
+ [-ProgressAction ] []
```
## DESCRIPTION
@@ -115,6 +115,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```
+### -ProgressAction
+{{ Fill ProgressAction Description }}
+
+```yaml
+Type: System.Management.Automation.ActionPreference
+Parameter Sets: (All)
+Aliases: proga
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
### -ResourceGroupName
The name of the resource group.
The name is case insensitive.
diff --git a/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsContinuousExport.md b/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsContinuousExport.md
index 2b0f99446825..467c543e8b02 100644
--- a/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsContinuousExport.md
+++ b/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsContinuousExport.md
@@ -15,21 +15,21 @@ Get the Continuous Export configuration for this export id.
### List (Default)
```
Get-AzApplicationInsightsContinuousExport -Name -ResourceGroupName
- [-SubscriptionId ] [-DefaultProfile ]
+ [-SubscriptionId ] [-DefaultProfile ] [-ProgressAction ]
[]
```
### Get
```
Get-AzApplicationInsightsContinuousExport -ExportId -Name -ResourceGroupName
- [-SubscriptionId ] [-DefaultProfile ]
+ [-SubscriptionId ] [-DefaultProfile ] [-ProgressAction ]
[]
```
### GetViaIdentity
```
Get-AzApplicationInsightsContinuousExport -InputObject
- [-DefaultProfile ] []
+ [-DefaultProfile ] [-ProgressAction ] []
```
## DESCRIPTION
@@ -116,6 +116,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```
+### -ProgressAction
+{{ Fill ProgressAction Description }}
+
+```yaml
+Type: System.Management.Automation.ActionPreference
+Parameter Sets: (All)
+Aliases: proga
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
### -ResourceGroupName
The name of the resource group.
The name is case insensitive.
diff --git a/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsLinkedStorageAccount.md b/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsLinkedStorageAccount.md
index 14532704903e..e388706eea50 100644
--- a/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsLinkedStorageAccount.md
+++ b/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsLinkedStorageAccount.md
@@ -15,14 +15,14 @@ Returns the current linked storage settings for an Application Insights componen
### Get (Default)
```
Get-AzApplicationInsightsLinkedStorageAccount -Name -ResourceGroupName
- [-SubscriptionId ] [-DefaultProfile ]
+ [-SubscriptionId ] [-DefaultProfile ] [-ProgressAction ]
[]
```
### GetViaIdentity
```
Get-AzApplicationInsightsLinkedStorageAccount -InputObject
- [-DefaultProfile ] []
+ [-DefaultProfile ] [-ProgressAction ] []
```
## DESCRIPTION
@@ -86,6 +86,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```
+### -ProgressAction
+{{ Fill ProgressAction Description }}
+
+```yaml
+Type: System.Management.Automation.ActionPreference
+Parameter Sets: (All)
+Aliases: proga
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
### -ResourceGroupName
The name of the resource group.
The name is case insensitive.
diff --git a/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsMyWorkbook.md b/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsMyWorkbook.md
index 85ab41dab7b9..c41d3dc385b3 100644
--- a/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsMyWorkbook.md
+++ b/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsMyWorkbook.md
@@ -15,20 +15,20 @@ Get a single private workbook by its resourceName.
### List1 (Default)
```
Get-AzApplicationInsightsMyWorkbook [-SubscriptionId ] -Category [-CanFetchContent]
- [-Tag ] [-DefaultProfile ] []
+ [-Tag ] [-DefaultProfile ] [-ProgressAction ] []
```
### Get
```
Get-AzApplicationInsightsMyWorkbook -Name -ResourceGroupName [-SubscriptionId ]
- [-DefaultProfile ] []
+ [-DefaultProfile ] [-ProgressAction ] []
```
### List
```
Get-AzApplicationInsightsMyWorkbook -ResourceGroupName [-SubscriptionId ]
-Category [-CanFetchContent] [-LinkedSourceId ] [-Tag ]
- [-DefaultProfile ] []
+ [-DefaultProfile ] [-ProgressAction ] []
```
## DESCRIPTION
@@ -166,6 +166,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```
+### -ProgressAction
+{{ Fill ProgressAction Description }}
+
+```yaml
+Type: System.Management.Automation.ActionPreference
+Parameter Sets: (All)
+Aliases: proga
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
### -ResourceGroupName
The name of the resource group.
The name is case insensitive.
diff --git a/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsWebTest.md b/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsWebTest.md
index 89c922f9d669..e1cb33fd7d39 100644
--- a/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsWebTest.md
+++ b/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsWebTest.md
@@ -15,32 +15,32 @@ Get a specific Application Insights web test definition.
### List1 (Default)
```
Get-AzApplicationInsightsWebTest [-SubscriptionId ] [-DefaultProfile ]
- []
+ [-ProgressAction ] []
```
### Get
```
Get-AzApplicationInsightsWebTest -Name -ResourceGroupName [-SubscriptionId ]
- [-DefaultProfile ] []
+ [-DefaultProfile ] [-ProgressAction ] []
```
### List2
```
Get-AzApplicationInsightsWebTest -ResourceGroupName [-SubscriptionId ]
- -AppInsightsName [-DefaultProfile ]
+ -AppInsightsName [-DefaultProfile ] [-ProgressAction ]
[]
```
### List
```
Get-AzApplicationInsightsWebTest -ResourceGroupName [-SubscriptionId ]
- [-DefaultProfile ] []
+ [-DefaultProfile ] [-ProgressAction ] []
```
### GetViaIdentity
```
Get-AzApplicationInsightsWebTest -InputObject [-DefaultProfile ]
- []
+ [-ProgressAction ] []
```
## DESCRIPTION
@@ -196,6 +196,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```
+### -ProgressAction
+{{ Fill ProgressAction Description }}
+
+```yaml
+Type: System.Management.Automation.ActionPreference
+Parameter Sets: (All)
+Aliases: proga
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
### -ResourceGroupName
The name of the resource group.
The name is case insensitive.
diff --git a/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsWorkbook.md b/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsWorkbook.md
index fab0ea91520b..853353ed7a48 100644
--- a/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsWorkbook.md
+++ b/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsWorkbook.md
@@ -15,26 +15,26 @@ Get a single workbook by its resourceName.
### List (Default)
```
Get-AzApplicationInsightsWorkbook [-SubscriptionId ] [-CanFetchContent] -Category
- [-Tag ] [-DefaultProfile ] []
+ [-Tag ] [-DefaultProfile ] [-ProgressAction ] []
```
### Get
```
Get-AzApplicationInsightsWorkbook -Name -ResourceGroupName [-SubscriptionId ]
- [-CanFetchContent] [-DefaultProfile ] []
+ [-CanFetchContent] [-DefaultProfile ] [-ProgressAction ] []
```
### List1
```
Get-AzApplicationInsightsWorkbook -ResourceGroupName [-SubscriptionId ] [-CanFetchContent]
-Category [-Tag ] [-LinkedSourceId ] [-DefaultProfile ]
- []
+ [-ProgressAction ] []
```
### GetViaIdentity
```
Get-AzApplicationInsightsWorkbook -InputObject [-CanFetchContent]
- [-DefaultProfile ] []
+ [-DefaultProfile ] [-ProgressAction ] []
```
## DESCRIPTION
@@ -206,6 +206,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```
+### -ProgressAction
+{{ Fill ProgressAction Description }}
+
+```yaml
+Type: System.Management.Automation.ActionPreference
+Parameter Sets: (All)
+Aliases: proga
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
### -ResourceGroupName
The name of the resource group.
The name is case insensitive.
diff --git a/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsWorkbookRevision.md b/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsWorkbookRevision.md
index 2d338e12f553..d84f9cf03138 100644
--- a/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsWorkbookRevision.md
+++ b/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsWorkbookRevision.md
@@ -15,21 +15,21 @@ Get a single workbook revision defined by its revisionId.
### List (Default)
```
Get-AzApplicationInsightsWorkbookRevision -Name -ResourceGroupName
- [-SubscriptionId ] [-DefaultProfile ]
+ [-SubscriptionId ] [-DefaultProfile ] [-ProgressAction ]
[]
```
### Get
```
Get-AzApplicationInsightsWorkbookRevision -Name -ResourceGroupName -RevisionId
- [-SubscriptionId ] [-DefaultProfile ]
+ [-SubscriptionId ] [-DefaultProfile ] [-ProgressAction ]
[]
```
### GetViaIdentity
```
Get-AzApplicationInsightsWorkbookRevision -InputObject
- [-DefaultProfile ] []
+ [-DefaultProfile ] [-ProgressAction ] []
```
## DESCRIPTION
@@ -74,7 +74,7 @@ ResourceGroupName Name DisplayName
appinsights-hkrs2v-test f7d7151e-7907-4f46-8a5e-6bf4a4cfedec f7d7151e-7907-4f46-8a5e-6bf4a4cfedec-display westus2 shared workbook
```
-This commmand gets a single workbook revision defined by resource id.
+This command gets a single workbook revision defined by resource id.
## PARAMETERS
@@ -125,6 +125,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```
+### -ProgressAction
+{{ Fill ProgressAction Description }}
+
+```yaml
+Type: System.Management.Automation.ActionPreference
+Parameter Sets: (All)
+Aliases: proga
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
### -ResourceGroupName
The name of the resource group.
The name is case insensitive.
diff --git a/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsWorkbookTemplate.md b/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsWorkbookTemplate.md
index 040973d5563c..33ccbda901bd 100644
--- a/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsWorkbookTemplate.md
+++ b/src/ApplicationInsights/ApplicationInsights/help/Get-AzApplicationInsightsWorkbookTemplate.md
@@ -15,14 +15,14 @@ Get a single workbook template by its resourceName.
### Get (Default)
```
Get-AzApplicationInsightsWorkbookTemplate -Name -ResourceGroupName
- [-SubscriptionId ] [-DefaultProfile ]
+ [-SubscriptionId ] [-DefaultProfile ] [-ProgressAction ]
[]
```
### GetViaIdentity
```
Get-AzApplicationInsightsWorkbookTemplate -InputObject
- [-DefaultProfile ] []
+ [-DefaultProfile ] [-ProgressAction ] []
```
## DESCRIPTION
@@ -134,6 +134,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```
+### -ProgressAction
+{{ Fill ProgressAction Description }}
+
+```yaml
+Type: System.Management.Automation.ActionPreference
+Parameter Sets: (All)
+Aliases: proga
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
### -ResourceGroupName
The name of the resource group.
The name is case insensitive.
diff --git a/src/ApplicationInsights/ApplicationInsights/help/New-AzApplicationInsights.md b/src/ApplicationInsights/ApplicationInsights/help/New-AzApplicationInsights.md
index b8d6b441d288..8e4300a5d3cb 100644
--- a/src/ApplicationInsights/ApplicationInsights/help/New-AzApplicationInsights.md
+++ b/src/ApplicationInsights/ApplicationInsights/help/New-AzApplicationInsights.md
@@ -21,7 +21,7 @@ New-AzApplicationInsights -ResourceGroupName -Name [-Subscript
[-PublicNetworkAccessForIngestion ]
[-PublicNetworkAccessForQuery ] [-RequestSource ]
[-RetentionInDays ] [-SamplingPercentage ] [-Tag ] [-WorkspaceResourceId ]
- [-DefaultProfile ] [-WhatIf] [-Confirm] []
+ [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] []
```
## DESCRIPTION
@@ -236,6 +236,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```
+### -ProgressAction
+{{ Fill ProgressAction Description }}
+
+```yaml
+Type: System.Management.Automation.ActionPreference
+Parameter Sets: (All)
+Aliases: proga
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
### -PublicNetworkAccessForIngestion
The network access type for accessing Application Insights ingestion.
diff --git a/src/ApplicationInsights/ApplicationInsights/help/New-AzApplicationInsightsApiKey.md b/src/ApplicationInsights/ApplicationInsights/help/New-AzApplicationInsightsApiKey.md
index cff11b772f1d..2b4af74f633d 100644
--- a/src/ApplicationInsights/ApplicationInsights/help/New-AzApplicationInsightsApiKey.md
+++ b/src/ApplicationInsights/ApplicationInsights/help/New-AzApplicationInsightsApiKey.md
@@ -15,7 +15,7 @@ Create an API Key of an Application Insights component.
```
New-AzApplicationInsightsApiKey -ResourceGroupName -Name [-SubscriptionId ]
-Description -Permissions [-DefaultProfile ]
- [-WhatIf] [-Confirm] []
+ [-ProgressAction ] [-WhatIf] [-Confirm] []
```
## DESCRIPTION
@@ -94,6 +94,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```
+### -ProgressAction
+{{ Fill ProgressAction Description }}
+
+```yaml
+Type: System.Management.Automation.ActionPreference
+Parameter Sets: (All)
+Aliases: proga
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
### -ResourceGroupName
The name of the resource group.
The name is case insensitive.
diff --git a/src/ApplicationInsights/ApplicationInsights/help/New-AzApplicationInsightsContinuousExport.md b/src/ApplicationInsights/ApplicationInsights/help/New-AzApplicationInsightsContinuousExport.md
index 1f61e11aa386..4c97d88efcdd 100644
--- a/src/ApplicationInsights/ApplicationInsights/help/New-AzApplicationInsightsContinuousExport.md
+++ b/src/ApplicationInsights/ApplicationInsights/help/New-AzApplicationInsightsContinuousExport.md
@@ -16,7 +16,7 @@ Create a Continuous Export configuration of an Application Insights component.
New-AzApplicationInsightsContinuousExport -ResourceGroupName -Name [-SubscriptionId ]
[-DestinationType ] [-NotificationQueueEnabled ] [-NotificationQueueUri ]
[-DocumentType ] [-StorageAccountId ] [-StorageLocation ] [-StorageSASUri ]
- [-DefaultProfile ] [-WhatIf] [-Confirm] []
+ [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [