I am using azure-identity and azure-storage-file-share package in Flask.
The app is trying to connect to Azure storage using User assigned managed identity, to read the File Share.
I have created the UAMI and assigned the roles Storage Blob Data Contributor
and Storage File Data Privileged Contributor
in Azure storage.
The application is deployed in AKS cluster.
Help/Feedback is appreciated.
I am getting the error below in my pod logs when trying to access the storage account.
My application code
is simple
Update:
I confirmed that my Managed Identity has Storage Blob Data Contributor
and Storage File Data Privileged Contributor
in Azure storage.
Now I changed my application code slighly on @Venkatesan comment as follows
After deploying in AKS cluster. I am getting following error in my pod logs:
I went to my Managed Identity and checked Azure role assignments
.
It does have proper roles to the storage account.
What am I missing??
The above error occurs when your
UAMI
(User-assigned managed identity) doesn't have access to Azure file storage.In my environment, I created UAMI(User-assigned managed identity) and added
Storage File Data Privileged Contributor
to my Azure storage account.Portal:
You can refer to this MS-document to Specify a user-assigned managed identity for
DefaultAzureCredential
.When I tried the below sample code to fetch a list file name with managed identity with
client id
using Azure Python SDK it executed successfully.Code:
Output: