From af2e143dfa9035b9c32efed77aa8d0ca0e4480f1 Mon Sep 17 00:00:00 2001 From: Bradley Bartlett Date: Wed, 9 May 2018 16:04:22 -0700 Subject: [PATCH] Fix for new resource properties and RBAC assignment Objects returned from Get-AzureRmResource no longer have a SubscriptionId property and so the rbac scope was being built improperly. --- Registration/RegisterWithAzure.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Registration/RegisterWithAzure.psm1 b/Registration/RegisterWithAzure.psm1 index 471d197..4032de0 100644 --- a/Registration/RegisterWithAzure.psm1 +++ b/Registration/RegisterWithAzure.psm1 @@ -1206,7 +1206,7 @@ function New-RBACAssignment{ Log-Output "Setting $RoleName role on '$($RegistrationResource.ResourceId)'" # Determine if RBAC role has been assigned - $roleAssignmentScope = "/subscriptions/$($RegistrationResource.SubscriptionId)/resourceGroups/$($RegistrationResource.ResourceGroupName)/providers/Microsoft.AzureStack/registrations/$($RegistrationResource.ResourceName)" + $roleAssignmentScope = "/subscriptions/$SubscriptionId/resourceGroups/$($RegistrationResource.ResourceGroupName)/providers/Microsoft.AzureStack/registrations/$($RegistrationResource.ResourceName)" $roleAssignments = Get-AzureRmRoleAssignment -Scope $roleAssignmentScope -ObjectId $ServicePrincipal.ObjectId foreach ($role in $roleAssignments)