Skip to content

Commit

Permalink
Refactor role assignment queries in full.tests.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
sebassem committed Dec 25, 2023
1 parent b902c56 commit 6cd741c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/pester/full.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Describe "Bicep Landing Zone (Sub) Vending Tests" {
$iterationCount = 0
do {
#$roleAssignment = Get-AzRoleAssignment -Scope "/subscriptions/$subId" -RoleDefinitionName "Reader" -ObjectId "7eca0dca-6701-46f1-b7b6-8b424dab50b3" -ErrorAction SilentlyContinue
$roleAssignment = Get-AzRoleAssignment -Scope "/subscriptions/$subId" | Where-Object { $_.ObjectId -eq "7eca0dca-6701-46f1-b7b6-8b424dab50b3" -and $_.RoleDefinitionName -eq "Reader"} -ErrorAction SilentlyContinue
$roleAssignment = Get-AzRoleAssignment -Scope "/subscriptions/$subId" -ErrorAction SilentlyContinue | Where-Object { $_.ObjectId -eq "7eca0dca-6701-46f1-b7b6-8b424dab50b3" -and $_.RoleDefinitionName -eq "Reader"}
if ($null -eq $roleAssignment) {
Write-Host "Waiting for Subscription Role Assignments to be eventually consistent... Iteration: $($iterationCount)" -ForegroundColor Yellow
Start-Sleep -Seconds 40
Expand All @@ -85,7 +85,7 @@ Describe "Bicep Landing Zone (Sub) Vending Tests" {
$iterationCount = 0
do {
#$roleAssignment = Get-AzRoleAssignment -Scope "/subscriptions/$subId/resourceGroups/rsg-$location-net-hs-pr-$prNumber" -RoleDefinitionName "Network Contributor" -ObjectId "7eca0dca-6701-46f1-b7b6-8b424dab50b3" -ErrorAction SilentlyContinue
$roleAssignment = Get-AzRoleAssignment -Scope "/subscriptions/$subId/resourceGroups/rsg-$location-net-hs-pr-$prNumber" | Where-Object { $_.ObjectId -eq "7eca0dca-6701-46f1-b7b6-8b424dab50b3" -and $_.RoleDefinitionName -eq "Network Contributor"} -ErrorAction SilentlyContinue
$roleAssignment = Get-AzRoleAssignment -Scope "/subscriptions/$subId/resourceGroups/rsg-$location-net-hs-pr-$prNumber" -ErrorAction SilentlyContinue | Where-Object { $_.ObjectId -eq "7eca0dca-6701-46f1-b7b6-8b424dab50b3" -and $_.RoleDefinitionName -eq "Network Contributor"}
if ($null -eq $roleAssignment) {
Write-Host "Waiting for Resource Group Role Assignments to be eventually consistent... Iteration: $($iterationCount)" -ForegroundColor Yellow
Start-Sleep -Seconds 40
Expand Down

0 comments on commit 6cd741c

Please sign in to comment.