Skip to content

Commit

Permalink
Fix error handling in Get-AzRoleAssignment
Browse files Browse the repository at this point in the history
  • Loading branch information
sebassem committed Jan 16, 2024
1 parent be1e8d5 commit 727417d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/pester/full.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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 (
Expand Down

0 comments on commit 727417d

Please sign in to comment.