AzRoleAssignment Exception of type 'Microsoft.Rest.Azure.CloudException' thrown

Copper Contributor

I am using devops pipeline (yaml script) to provide access to the objects. The keyvault access permission is working where as the role assignment is not working. Please help.

Write-Host "The daf id is - " $ObjId

 

working command

Set-AzKeyVaultAccessPolicy -VaultName "$(KVName)" -ObjectId "$ObjId" -PermissionsToSecrets get,list,set -PermissionsToKeys get,list -PermissionsToCertificates get,list -BypassObjectIdValidation

 

NOT working command

New-AzRoleAssignment -ObjectId "$ObjId" -Scope "/subscriptions/527659-b8e9-7b3c-a1ff-d32646hdd3a/resourceGroups/rg-DataPlatform/providers/Microsoft.Storage/storageAccounts/dsstore" -RoleDefinitionName "Contributor"

0 Replies