From bash unable to create a role assignment for an Service Principal scoped to management group
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
When the same command from the terminal using the same login account, runs without error. If I use the same command in a bash script, then I get this error message. The Document reference doesn't include an example for role assignment for a management group. Could we add an example here please?
Any clue why this is failing?
Command Run: `az role assignment create --assignee-object-id $sp_id --assignee-principal-type "ServicePrincipal" --role "Owner" --scope $mgmt_id `
Error Message : The request did not have a subscription or a valid tenant level resource provider.
---
#### Document Details
⚠ *Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.*
* ID: 9dacfad8-cb2f-2534-3b29-89b0930a2252
* Version Independent ID: 17325cd4-44c5-4069-d9f6-940a55f0f7c9
* Content: [az role assignment](https://learn.microsoft.com/en-US/cli/azure/role/assignment?view=azure-cli-latest#az_role_assignment_create)
* Content Source: [latest/docs-ref-autogen/role/assignment.yml](https://github.com/MicrosoftDocs/azure-docs-cli/blob/main/latest/docs-ref-autogen/role/assignment.yml)
* Service: **azure-resource-manager**
* GitHub Login: @rloutlaw
* Microsoft Alias: **routlaw**
Contributor guide
Assessment
This issue has not been assessed yet.