I’m hosting a WebApp on Azure (Linux) that connects to Cosmos DB.
When running the app locally, I use azd auth login, and it works perfectly. However, when the app is hosted on Azure, I understand that I should use a System Assigned Managed Identity for authentication.
Here’s what I’ve done so far:
1. Enabled the System Assigned Managed Identity for the WebApp.
2. Assigned the Contributor and Reader roles to the resource group.
Despite these steps, the app throws a 500 error when trying to connect to Cosmos DB. Checking the browser dev tools confirmed the error but didn’t provide much detail.
I also tried setting up the Cosmos DB dependency using the Visual Studio Publish GUI, but it made no difference.
What could I be missing? Are there additional permissions or configurations required for the managed identity to access Cosmos DB.