I have successfully added application permissions to my system assigned Managed Identity/Service principal/MSI (Enterprise app) connected to a Azure Function through the following guide.
I have previously used a separately created App registration/Enterprise app and used a secret from it to acquire a token to use when sending requests to Microsoft Graph API.
def get_auth_token_appreg(secret):
app = msal.ConfidentialClientApplication(appreg_client_id, authority=appreg_tenant_id, client_credential=secret)
result = None
result = app.acquire_token_silent(default_scope, account=None)
if not result:
result = app.acquire_token_for_client(default_scope)
return result["access_token"]
I can't figure out how (if it's possible) to use this MSI without using a app registration secret in Python. Since there is no app registration I'm not even sure I can't get a secret for this MSI. I don't want a to use a secret but rather utilize the MSI (with it's permissions) instead since a secret kinda defeats the purpose of adding permissions to the MSI.
Any ideas?