From Python script I'd like to login to Azure account and check if I have assigned a given role in a given subscription.
The important thing is that the MFA is configured (with Authenticator app but also with TOTP codes).
I will have username, password and TOTP code in the script.
I found Microsoft Authentication Library (MSAL) for Python but so far I don't see a way to use it in this scenario.
As far as I know this is not a supported scenario with MSAL, as MFA is meant as user interaction (not machine interaction).
I would recommend not using a personal account for this kind of activity but to use a Service Principal that has the permissions to view roles.
Programmatically authenticate in Azure with MFA