New-AzRoleAssignment command failing due to wrong validation #22558
Labels
bug
This issue requires a change to an existing behavior in the product in order to be resolved.
needs-triage
This is a new issue that needs to be triaged to the appropriate team.
Description
The following New-AzRoleAssignment command failed to create the Role assignment because of a wrong validation. The scope that we are entering is correct. We dont want to create the role assignment in the resource group level but only restricted to the database account level and the same command in Azure CLI works with no issues.
Powershell command:
New-AzRoleAssignment -debug -ObjectId 798e7ae5-a0d9-4cb0-bce3-5dc515f7f683 -RoleDefinitionName CosmosRestoreOperator -Scope "/subscriptions/259fbb24-9bcd-4cfc-865c-fc33b22fe38a/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/f8c9b302-e047-4f58-b920-fd92e5fbaa3d"
CLI command:
az role assignment create --role "CosmosRestoreOperator" --assignee ddhamotharan@microsoft.com --scope /subscriptions/259fbb24-9bcd-4cfc-865c-fc33b22fe38a/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/f8c9b302-e047-4f58-b920-fd92e5fbaa3d
Issue script & Debug output
Environment data
Module versions
Error output
The text was updated successfully, but these errors were encountered: