When running a .NET 6 application inside a an Azure Function v4 Linux container locally on my physical developer laptop, I want to authenticate with Azure using the Azure CLI credentials from the Docker host machine. I.e. I am already logged in to Azure on the host pc running Docker and I would like to reuse those same credentials inside the Docker container, without having to re-enter the username/password, without hardcoding the credentials, without creating a service principal.
I've tried mounting $HOME/.azure
as ~/.azure
inside the Docker container, but Azure CLI prompts me to login whenever I execute Azure CLI commands inside the container, giving me the error User '<my email>' does not exist in MSAL token cache. Run 'az login'.