Skip to content

Commit

Permalink
Skip unnecessary and misleading role assignment warnings in local tes…
Browse files Browse the repository at this point in the history
…t resource deployment (#18066)

Co-authored-by: Ben Broderick Phillips <[email protected]>
  • Loading branch information
azure-sdk and benbp authored Oct 7, 2021
1 parent 2a29ea7 commit b27dcc0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion eng/common/TestResources/New-TestResources.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,10 @@ try {
# service principal without permissions to grant RBAC roles to other service principals. That should not be
# considered a critical failure, as the test application may have subscription-level permissions and not require
# the explicit grant.
if (!$resourceGroupRoleAssigned) {
#
# Ignore this check if $AzureTestPrincipal is specified as role assignment will already have been attempted on a
# previous run, and these error messages can be misleading for local runs.
if (!$resourceGroupRoleAssigned -and !$AzureTestPrincipal) {
Log "Attempting to assigning the 'Owner' role for '$ResourceGroupName' to the Test Application '$TestApplicationId'"
$principalOwnerAssignment = New-AzRoleAssignment -RoleDefinitionName "Owner" -ApplicationId "$TestApplicationId" -ResourceGroupName "$ResourceGroupName" -ErrorAction SilentlyContinue

Expand Down

0 comments on commit b27dcc0

Please sign in to comment.