-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Closed
Labels
Azure PS TeamInvestigate 🔍Monitor - ApplicationInsightsbugThis issue requires a change to an existing behavior in the product in order to be resolved.This issue requires a change to an existing behavior in the product in order to be resolved.customer-reported
Description
Description
When using -ErrorAction Stop with the cmdlet Get-AzApplicationInsights and using -ResourceId, the error doesn't behave as expected. Execution continues after not finding the resource.
Issue script & Debug output
$DebugPreference = 'Continue'
Get-AzApplicationInsights -ResourceId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-lucas/providers/microsoft.insights/components/plat-o-test-lucas" -ErrorAction Stop
'hello'
DEBUG: [CmdletBeginProcessing]: Starting command
DEBUG: CmdletBeginProcessing:
DEBUG: CmdletProcessRecordStart:
DEBUG: CmdletGetPipeline:
DEBUG: CmdletBeforeAPICall:
DEBUG: URLCreated: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-lucas/providers/microsoft.insights/components/plat-o-test-lucas?api-version=2020-02-02
DEBUG: RequestCreated: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-lucas/providers/microsoft.insights/components/plat-o-test-lucas?api-version=2020-02-02
DEBUG: HeaderParametersAdded:
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-lucas/providers/microsoft.insights/components/plat-o-test-lucas?api-version=2020-02-02
Headers:
x-ms-unique-id : 1643,1644
x-ms-client-request-id : 53a92489-b9e4-4059-9a47-71ca2ec20336
CommandName : .
FullCommandName : Get-AzApplicationInsights_GetViaIdentity
ParameterSetName : __AllParameterSets
User-Agent : AzurePowershell/v10.2.0,PSVersion/v7.4.0,Az.ApplicationInsights/2.2.2
Body:
DEBUG: BeforeCall:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
NotFound
Headers:
Cache-Control : no-cache
Pragma : no-cache
x-ms-failure-cause : gateway
x-ms-request-id : 4ce7adcb-d268-49f6-ba79-69efcf25f469
x-ms-correlation-request-id : 4ce7adcb-d268-49f6-ba79-69efcf25f469
x-ms-routing-request-id : WESTEUROPE:20231129T160453Z:4ce7adcb-d268-49f6-ba79-69efcf25f469
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
X-Cache : CONFIG_NOCACHE
X-MSEdge-Ref : Ref A: 8C61DF57DD0B4E4F8F5A825C4EC78BB8 Ref B: AMS231022012027 Ref C: 2023-11-29T16:04:53Z
Date : Wed, 29 Nov 2023 16:04:53 GMT
Body:
{
"error": {
"code": "ResourceNotFound",
"message": "The Resource 'microsoft.insights/components/plat-o-test-lucas' under resource group 'test-lucas' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix"
}
}
DEBUG: ResponseCreated:
DEBUG: BeforeResponseDispatch:
Get-AzApplicationInsights_GetViaIdentity: C:\Users\lucas\Documents\PowerShell\Modules\Az.ApplicationInsights\2.2.2\custom\Get-AzApplicationInsights.ps1:129:17
Line |
129 | … $component = ($resourceId | . Az.ApplicationInsights.inte …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The Resource 'microsoft.insights/components/plat-o-test-lucas' under resource group 'test-lucas' was not found. For more details please go to
| https://aka.ms/ARMResourceNotFoundFix
DEBUG: [Finally]: Getting exception 'Microsoft.Azure.Commands.Common.Exceptions.AzPSResourceNotFoundCloudException: InternalException' from response
DEBUG: Finally:
DEBUG: CmdletAfterAPICall:
DEBUG: [CmdletProcessRecordAsyncEnd]: Finish HTTP process
DEBUG: CmdletProcessRecordAsyncEnd:
DEBUG: CmdletProcessRecordEnd:
DEBUG: AzureQoSEvent: Module: Az.ApplicationInsights:2.2.2; CommandName: Get-AzApplicationInsights; PSVersion: 7.4.0; IsSuccess: False; Duration: 00:00:00.2471354; Exception: InternalException;
helloEnvironment data
❯ $PSVersionTable
Name Value
---- -----
PSVersion 7.4.0
PSEdition Core
GitCommitId 7.4.0
OS Microsoft Windows 10.0.22621
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Module versions
❯ Get-Module az*
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.12.5 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script 4.0.2 Az.ApiManagement {Add-AzApiManagementApiToGateway, Add-AzApiManagementApiToProduct, Add-AzApiManagementProductToGroup,…
Script 2.2.2 Az.ApplicationInsights {Get-AzApplicationInsights, Get-AzApplicationInsightsApiKey, Get-AzApplicationInsightsContinuousExpor…
Script 1.6.2 Az.PolicyInsights {Get-AzPolicyAttestation, Get-AzPolicyEvent, Get-AzPolicyMetadata, Get-AzPolicyRemediation…}
Script 1.0.4 Az.PrivateDns {Add-AzPrivateDnsRecordConfig, Get-AzPrivateDnsRecordSet, Get-AzPrivateDnsVirtualNetworkLink, Get-AzP…
Script 6.9.0 Az.Resources {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAssignment, Get-AzDeployment…}Error output
[ResourceNotFound] : The Resource 'microsoft.insights/components/plat-o-test-lucas' under resource group 'test-lucas' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFixMetadata
Metadata
Assignees
Labels
Azure PS TeamInvestigate 🔍Monitor - ApplicationInsightsbugThis issue requires a change to an existing behavior in the product in order to be resolved.This issue requires a change to an existing behavior in the product in order to be resolved.customer-reported