How do I programmatically get list of identities with read access (AAD) to an Azure resource, for ex. a blob container?
I've explored Microsoft Graph APIs but could not find such a capability. Am I looking into the right direction?
How do I programmatically get list of identities with read access (AAD) to an Azure resource, for ex. a blob container?
I've explored Microsoft Graph APIs but could not find such a capability. Am I looking into the right direction?
There are 4 ways to list or read the user-assigned managed identity like Azure Portal, PowerShell, CLI and Azure Rest API.
In order to list or read them, your account assigned role should be Managed Identity Operator or Managed Identity Contributor.
Rest API (Programmatically - HTTP)
GET https://management.azure.com/subscriptions/<SUBSCRIPTION ID>/resourceGroups/<RESOURCE GROUP>/providers/Microsoft.ManagedIdentity/userAssignedIdentities?api-version=2015-08-31-preview HTTP/1.1
You can use Rest API programmatically from C# by following the steps from this # How to securely connect to Azure from C# and run REST APIs. and this SO Thread.
This Microsoft documentation helps you to assign the reader role or any other access role to the System-assigned managed identity and user-assigned managed identity.
To list out all the role assignments for the specified user in a subscription, then refer here.