Update user-assigned identity 'owner' role check

A problem was discovered where the section on line 571 that is supposed to check if the user-assigned managed identity has the owner role.  The check came back true because it was an incomplete check.  Revised check on line 572.
This commit is contained in:
Robert Smith 2021-12-10 10:46:57 -05:00 коммит произвёл GitHub
Родитель cdb2f51fe5
Коммит 17a4a59e3b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 1 добавлений и 2 удалений

Просмотреть файл

@ -569,8 +569,7 @@ Write-Host "`nCreating user-assigned managed identity account, which will be the
#region Grant the 'Owner' subscription level role to the managed identity #region Grant the 'Owner' subscription level role to the managed identity
Write-Host "Now checking if user assigned identity '$UserAssignedIdentityName' has 'Owner' subscription level role assignment" -ForegroundColor Cyan Write-Host "Now checking if user assigned identity '$UserAssignedIdentityName' has 'Owner' subscription level role assignment" -ForegroundColor Cyan
$UAMIOwnerSubRoleCheck = Get-AzUserAssignedIdentity -Name $UserAssignedIdentityName -ResourceGroupName $BlueprintGlobalResourceGroupName -ErrorAction SilentlyContinue if (-not(Get-AzRoleAssignment -ResourceGroupName $BlueprintGlobalResourceGroupName | Where {$_.DisplayName -eq $UserAssignedIdentityName -and $_.RoleDefinitionName -eq 'Owner'})){
if (-not($UAMIOwnerSubRoleCheck)){
Do { Do {
Write-Host "Waiting 3 seconds for user assigned managed identity '$UserAssignedIdentityName' to become available for next operation..." -ForegroundColor Cyan Write-Host "Waiting 3 seconds for user assigned managed identity '$UserAssignedIdentityName' to become available for next operation..." -ForegroundColor Cyan
Start-Sleep -Seconds 3 Start-Sleep -Seconds 3