@@ -27,12 +27,26 @@ Get-AzApplicationInsightsApiKey -ResourceGroupName "testGroup" -Name "test" -Api
2727. Inputs
2828Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Models.IApplicationInsightsIdentity
2929. Outputs
30- Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Models.Api20150501. IApplicationInsightsComponentApiKey
30+ Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Models.IApplicationInsightsComponentApiKey
3131. Notes
3232COMPLEX PARAMETER PROPERTIES
3333
3434To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
3535
36+ COMPONENTINPUTOBJECT <IApplicationInsightsIdentity>: Identity Parameter
37+ [AnnotationId <String>]: The unique annotation ID. This is unique within a Application Insights component.
38+ [ComponentName <String>]: The name of the Application Insights component resource.
39+ [ExportId <String>]: The Continuous Export configuration ID. This is unique within a Application Insights component.
40+ [Id <String>]: Resource identity path
41+ [KeyId <String>]: The API Key ID. This is unique within a Application Insights component.
42+ [PurgeId <String>]: In a purge status request, this is the Id of the operation the status of which is returned.
43+ [ResourceGroupName <String>]: The name of the resource group. The name is case insensitive.
44+ [ResourceName <String>]: The name of the Application Insights component resource.
45+ [RevisionId <String>]: The id of the workbook's revision.
46+ [StorageType <String>]: The type of the Application Insights component data source for the linked storage account.
47+ [SubscriptionId <String>]: The ID of the target subscription.
48+ [WebTestName <String>]: The name of the Application Insights WebTest resource.
49+
3650INPUTOBJECT <IApplicationInsightsIdentity>: Identity Parameter
3751 [AnnotationId <String>]: The unique annotation ID. This is unique within a Application Insights component.
3852 [ComponentName <String>]: The name of the Application Insights component resource.
@@ -43,17 +57,18 @@ INPUTOBJECT <IApplicationInsightsIdentity>: Identity Parameter
4357 [ResourceGroupName <String>]: The name of the resource group. The name is case insensitive.
4458 [ResourceName <String>]: The name of the Application Insights component resource.
4559 [RevisionId <String>]: The id of the workbook's revision.
46- [StorageType <StorageType? >]: The type of the Application Insights component data source for the linked storage account.
60+ [StorageType <String >]: The type of the Application Insights component data source for the linked storage account.
4761 [SubscriptionId <String>]: The ID of the target subscription.
4862 [WebTestName <String>]: The name of the Application Insights WebTest resource.
4963. Link
5064https://learn.microsoft.com/powershell/module/az.applicationinsights/get-azapplicationinsightsapikey
5165#>
5266function Get-AzApplicationInsightsApiKey {
53- [OutputType ([Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Models.Api20150501. IApplicationInsightsComponentApiKey ])]
67+ [OutputType ([Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Models.IApplicationInsightsComponentApiKey ])]
5468[CmdletBinding (DefaultParameterSetName = ' List' , PositionalBinding = $false )]
5569param (
5670 [Parameter (ParameterSetName = ' Get' , Mandatory )]
71+ [Parameter (ParameterSetName = ' GetViaIdentityComponent' , Mandatory )]
5772 [Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Category (' Path' )]
5873 [System.String ]
5974 # The API Key ID.
@@ -88,9 +103,14 @@ param(
88103 [Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Category (' Path' )]
89104 [Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Models.IApplicationInsightsIdentity ]
90105 # Identity Parameter
91- # To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
92106 ${InputObject} ,
93107
108+ [Parameter (ParameterSetName = ' GetViaIdentityComponent' , Mandatory , ValueFromPipeline )]
109+ [Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Category (' Path' )]
110+ [Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Models.IApplicationInsightsIdentity ]
111+ # Identity Parameter
112+ ${ComponentInputObject} ,
113+
94114 [Parameter ()]
95115 [Alias (' AzureRMContext' , ' AzureCredential' )]
96116 [ValidateNotNull ()]
@@ -147,6 +167,15 @@ begin {
147167 $PSBoundParameters [' OutBuffer' ] = 1
148168 }
149169 $parameterSet = $PSCmdlet.ParameterSetName
170+
171+ $testPlayback = $false
172+ $PSBoundParameters [' HttpPipelinePrepend' ] | Foreach-Object { if ($_ ) { $testPlayback = $testPlayback -or (' Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType ().FullName -and ' Playback' -eq $_.Target.Mode ) } }
173+
174+ $context = Get-AzContext
175+ if (-not $context -and -not $testPlayback ) {
176+ Write-Error " No Azure login detected. Please run 'Connect-AzAccount' to log in."
177+ exit
178+ }
150179
151180 if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet ]::PowerShellVersion) {
152181 [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet ]::PowerShellVersion = $PSVersionTable.PSVersion.ToString ()
@@ -168,11 +197,10 @@ begin {
168197 $mapping = @ {
169198 Get = ' Az.ApplicationInsights.private\Get-AzApplicationInsightsApiKey_Get' ;
170199 GetViaIdentity = ' Az.ApplicationInsights.private\Get-AzApplicationInsightsApiKey_GetViaIdentity' ;
200+ GetViaIdentityComponent = ' Az.ApplicationInsights.private\Get-AzApplicationInsightsApiKey_GetViaIdentityComponent' ;
171201 List = ' Az.ApplicationInsights.private\Get-AzApplicationInsightsApiKey_List' ;
172202 }
173- if ((' Get' , ' List' ) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey (' SubscriptionId' )) {
174- $testPlayback = $false
175- $PSBoundParameters [' HttpPipelinePrepend' ] | Foreach-Object { if ($_ ) { $testPlayback = $testPlayback -or (' Microsoft.Azure.PowerShell.Cmdlets.ApplicationInsights.Runtime.PipelineMock' -eq $_.Target.GetType ().FullName -and ' Playback' -eq $_.Target.Mode ) } }
203+ if ((' Get' , ' List' ) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey (' SubscriptionId' ) ) {
176204 if ($testPlayback ) {
177205 $PSBoundParameters [' SubscriptionId' ] = . (Join-Path $PSScriptRoot ' ..' ' utils' ' Get-SubscriptionIdTestSafe.ps1' )
178206 } else {
@@ -186,6 +214,9 @@ begin {
186214 [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet ]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name )
187215 }
188216 $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand (($mapping [$parameterSet ]), [System.Management.Automation.CommandTypes ]::Cmdlet)
217+ if ($wrappedCmd -eq $null ) {
218+ $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand (($mapping [$parameterSet ]), [System.Management.Automation.CommandTypes ]::Function)
219+ }
189220 $scriptCmd = {& $wrappedCmd @PSBoundParameters }
190221 $steppablePipeline = $scriptCmd.GetSteppablePipeline ($MyInvocation.CommandOrigin )
191222 $steppablePipeline.Begin ($PSCmdlet )
0 commit comments