'How to get Storage Account containers' role assignments from Access Control tab

i am trying to get all objects from Access Control tab from Storage Account container using powershell.

enter image description here

Using command:

Get-AzRoleAssignment -ResourceGroupName 'devtest' -ResourceName 'sa-name' -ResourceType 'Microsoft.Storage/storageAccounts'

I am get all objects from:

  • Storage Account
  • Containers

enter image description here

As you can see, using this command im getting scopes for Storage Account and Container in the same call.

I tried using command like:

Get-AzRoleAssignment -ResourceGroupName 'devtest' -ResourceName 'SA-name' -ResourceType 'Microsoft.Storage/storageAccounts' | Where-Object -Property Scope -Like '*containers/container-name'

But i am not happy with the results because i am not getting for example Owner of this container because it is inheritate from diffrent resource

My question is, how to get Role Assignments objects from IAM blade for specific container using powershell, CLI or REST API with all objects?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source