From 727417d7cd257536f874db18a565f19abf2ae507 Mon Sep 17 00:00:00 2001 From: Seif Bassem <38246040+sebassem@users.noreply.github.com> Date: Tue, 16 Jan 2024 12:32:53 +0200 Subject: [PATCH] Fix error handling in Get-AzRoleAssignment --- tests/pester/full.tests.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/pester/full.tests.ps1 b/tests/pester/full.tests.ps1 index d6d7273..c74e67e 100644 --- a/tests/pester/full.tests.ps1 +++ b/tests/pester/full.tests.ps1 @@ -65,10 +65,10 @@ Describe "Bicep Landing Zone (Sub) Vending Tests" { It "Should Have a Role Assignment for an known AAD Group with the Reader role directly upon the Subscription" { $iterationCount = 0 do { - $roleAssignment = Get-AzRoleAssignment -Scope "/subscriptions/$subId" -RoleDefinitionName "Reader" -ObjectId "7eca0dca-6701-46f1-b7b6-8b424dab50b3" + $roleAssignment = Get-AzRoleAssignment -Scope "/subscriptions/$subId" -RoleDefinitionName "Reader" -ObjectId "7eca0dca-6701-46f1-b7b6-8b424dab50b3" -ErrorAction SilentlyContinue if ($null -eq $roleAssignment) { Write-Host "Waiting for Subscription Role Assignments to be eventually consistent... Iteration: $($iterationCount)" -ForegroundColor Yellow - Start-Sleep -Seconds 45 + Start-Sleep -Seconds 40 $iterationCount++ } } until ( @@ -86,7 +86,7 @@ Describe "Bicep Landing Zone (Sub) Vending Tests" { $roleAssignment = Get-AzRoleAssignment -Scope "/subscriptions/$subId/resourceGroups/rsg-$location-net-hs-pr-$prNumber" -RoleDefinitionName "Network Contributor" -ObjectId "7eca0dca-6701-46f1-b7b6-8b424dab50b3" -ErrorAction SilentlyContinue if ($null -eq $roleAssignment) { Write-Host "Waiting for Resource Group Role Assignments to be eventually consistent... Iteration: $($iterationCount)" -ForegroundColor Yellow - Start-Sleep -Seconds 45 + Start-Sleep -Seconds 40 $iterationCount++ } } until (