Hello Saurabh Parmar
Welcome to Microsoft Q&A Forum. Thanks for posting your query here!
Apologise for the delay in response.
I understand that you would like to know how to write the query on Azure to get the information of particular SPN linked with all the folders present in containers.
Please be informed that Azure Blob Storage itself doesn't inherently store access control information at the folder level. Permissions are typically assigned at the container level or through inheritance from a parent container. Here's an approach to identify the SPN associated with each container in your Azure Blob Storage account.
However please find below Identify Container Access Policies
- Go to the Azure portal and navigate to your storage account.
- Select the container you're interested in.
- Under "Settings," click on "Access control (IAM).
- This will show you the list of Shared Access Signatures (SAS) or Azure Active Directory (AAD) identities (like SPNs) that have access to the container and their permission levels.
Post which Write a script (Python, PowerShell, etc.) that iterates through all your containers in the storage account. For each container, use the methods mentioned above to retrieve the access control information (SAS or AAD identities). Store the container name and associated SPN (if applicable) in a data structure (list, dictionary) for further processing or analysis.
Additional information:
If you're using Azure Data Lake Storage Gen2 with hierarchical namespace, you might need to adapt the script to navigate the directory structure and retrieve access control information for individual folders. Tools like Azure Data Explorer or the Azure SDKs might be helpful for working with hierarchical data. The script will need appropriate permissions to access container access control information. You can use an Azure AD application (with the necessary Azure roles) or a storage account access key to authenticate your script.
By following the above steps and adapting the script to your specific needs, you can retrieve the information about the SPN associated with each container in your Azure Blob Storage account.
NOTE: Remember that this approach won't directly provide folder-level SPN associations unless you're using Azure Data Lake Storage Gen2 with hierarchical namespace.
Let me know if you have any further quarries we are here at your service!