Skip to content

Commit 48d05eb

Browse files
azure-sdkbenbp
andauthored
Skip unnecessary and misleading role assignment warnings in local test resource deployment (Azure#24580)
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
1 parent 61ea58e commit 48d05eb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

eng/common/TestResources/New-TestResources.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,10 @@ try {
463463
# service principal without permissions to grant RBAC roles to other service principals. That should not be
464464
# considered a critical failure, as the test application may have subscription-level permissions and not require
465465
# the explicit grant.
466-
if (!$resourceGroupRoleAssigned) {
466+
#
467+
# Ignore this check if $AzureTestPrincipal is specified as role assignment will already have been attempted on a
468+
# previous run, and these error messages can be misleading for local runs.
469+
if (!$resourceGroupRoleAssigned -and !$AzureTestPrincipal) {
467470
Log "Attempting to assigning the 'Owner' role for '$ResourceGroupName' to the Test Application '$TestApplicationId'"
468471
$principalOwnerAssignment = New-AzRoleAssignment -RoleDefinitionName "Owner" -ApplicationId "$TestApplicationId" -ResourceGroupName "$ResourceGroupName" -ErrorAction SilentlyContinue
469472

0 commit comments

Comments
 (0)