question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

az role assignment create fails

See original GitHub issue

az role assignment create --debug --assignee XXX-XXX-XXX-XXX-XXX --role XXX-XXX-XXX-XXX-XXX --resource-group rgname

fails with The request was incorrectly formatted.


msrest.http_logger : Request body:
msrest.http_logger : {"properties": {"roleDefinitionId": "XXX-XXX-XXX-XXX-XXX", "principalId": "XXX-XXX-XXX-XXX-XXX"}}
requests.packages.urllib3.connectionpool : Starting new HTTPS connection (1): management.azure.com
requests.packages.urllib3.connectionpool : https://management.azure.com:443 "PUT /subscriptions/XXX-XXX-XXX-XXX-XXX/resourceGroups/XXX/providers/Microsoft.Authorization/roleAssignments/XXX-XXX-XXX-XXX-XXX?api-version=2015-07-01 HTTP/1.1" 400 88
msrest.http_logger : Response status: 400

msrest.http_logger : Response content:
msrest.http_logger : b'{"error":{"code":"BadRequestFormat","message":"The request was incorrectly formatted."}}'
msrest.exceptions : The request was incorrectly formatted.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
tzarooncommented, Feb 8, 2022

Issue Resolved on my end.

I was trying to give the role to the storage in the bicep.

var storageBlobDataContributorRoleID = 'ba92f5b4-2d11-453d-a403-e96b0029c9fe'

I was writing this property as : roleDefinitionId: storageBlobDataContributorRoleID it failed

Then I tried this one: roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', storageBlobDataContributorRoleID)

It worked perfectly.

3reactions
hasheddancommented, Sep 6, 2019

@asc-adean are you still experiencing this issue?

I believe it will function correctly if you provide your role_definition_id in the following format:

/subscriptions/${var.subscription_id}/providers/Microsoft.Authorization/roleDefinitions/1c0163c0-47e6-4577-8991-ea5c82e286e4
Read more comments on GitHub >

github_iconTop Results From Across the Web

az role assignment creating fails on role definitions which are ...
Describe the bug. Command Name az role assignment create. Errors: list index out of range Traceback (most recent call last): cli ...
Read more >
When I run az ad sp create-for-rbac --sdk-auth > my.azureauth ...
WARNING: In a future release, this command will NOT create a 'Contributor' role assignment by default. If needed, use the --role argument to ......
Read more >
Preparing to Deploy Ops Manager on Azure
If logging in to AzureChinaCloud fails with a CERT_UNTRUSTED , use the ... az role assignment create --assignee "SERVICE-PRINCIPAL-NAME" ...
Read more >
azure-cli 2.22.1 - PyPI
[BREAKING CHANGE] az synapse role assignment create : When –assignee argument can't uniquely determine the principal object, the command will raise error ...
Read more >
Azure Managed ID - How to assign Multiple RBAC Roles via ...
az deployment group create ` --resource-group $RESOURCE_GROUP ... If you want to create multiple assignment at the same time, you could use ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found