Make sure to:
- Create a service principal by following https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
- Set the values of the client ID, tenant ID and client secret of the AAD application as environment variables in the session you're running your Python code in: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET.
- Assign the service principal the reader role in the scope of your Azure subscription
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin