Just putting this as a bookmark to myself. If you want to get access tokens for the Managed Identity used in an Azure Function or App Service this document is the one to refer. Also, this blog post.
I am quite gung-ho on Managed Identities nowadays. So much easier and secure to use them.