From 86d2303e8b4a35e404574863f28cb59d7f3f1440 Mon Sep 17 00:00:00 2001 From: Jesper Fajers Date: Fri, 1 Mar 2024 06:38:31 +0000 Subject: [PATCH] Update --- src/functions/Invoke-AzOpsPush.ps1 | 2 +- src/internal/functions/Remove-AzOpsDeployment.ps1 | 2 +- src/internal/functions/Remove-AzResourceRaw.ps1 | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/functions/Invoke-AzOpsPush.ps1 b/src/functions/Invoke-AzOpsPush.ps1 index d48c044d..5525c61f 100644 --- a/src/functions/Invoke-AzOpsPush.ps1 +++ b/src/functions/Invoke-AzOpsPush.ps1 @@ -568,7 +568,7 @@ # Check each failed removal and attempt to get the associated resource foreach ($fail in $removeActionFail) { $resource = $null - $resource = Get-AzOpsResource -ScopeObject $fail.ScopeObject + $resource = Get-AzOpsResource -ScopeObject $fail.ScopeObject -ErrorAction SilentlyContinue # If the resource is found, log the failure if ($resource) { $throwFail = $true diff --git a/src/internal/functions/Remove-AzOpsDeployment.ps1 b/src/internal/functions/Remove-AzOpsDeployment.ps1 index 82639a1a..1d71ad54 100644 --- a/src/internal/functions/Remove-AzOpsDeployment.ps1 +++ b/src/internal/functions/Remove-AzOpsDeployment.ps1 @@ -352,7 +352,7 @@ $resourceScopeObject = $null # Check if the resource exists $resourceScopeObject = New-AzOpsScope -Scope $change.FullyQualifiedResourceId -WhatIf:$false - $resource = Get-AzOpsResource -ScopeObject $resourceScopeObject + $resource = Get-AzOpsResource -ScopeObject $resourceScopeObject -ErrorAction SilentlyContinue if ($resource) { $results = 'What if successful:{1}Performing the operation:{1}Deletion of target resource {0}.' -f $resourceScopeObject.Scope, [environment]::NewLine $allResults += $results diff --git a/src/internal/functions/Remove-AzResourceRaw.ps1 b/src/internal/functions/Remove-AzResourceRaw.ps1 index 1a8304ea..74c3253d 100644 --- a/src/internal/functions/Remove-AzResourceRaw.ps1 +++ b/src/internal/functions/Remove-AzResourceRaw.ps1 @@ -41,7 +41,7 @@ Status = 'success' } # Check if the resource exists - $resource = Get-AzOpsResource -ScopeObject $ScopeObject + $resource = Get-AzOpsResource -ScopeObject $ScopeObject -ErrorAction SilentlyContinue # Remove the resource if it exists if ($resource) { try { @@ -54,7 +54,7 @@ while ($gone -eq $false -and $attempt -le $maxAttempts) { Write-AzOpsMessage -LogLevel InternalComment -LogString 'Remove-AzResourceRaw.Resource.CheckExistence' -LogStringValues $ScopeObject.Scope Start-Sleep -Seconds 10 - $tryResource = Get-AzOpsResource -ScopeObject $ScopeObject + $tryResource = Get-AzOpsResource -ScopeObject $ScopeObject -ErrorAction SilentlyContinue if (-not $tryResource) { $gone = $true }