Let's explore Azure Functions & Azure Cosmos DB - Part 1
Bervianto Leo Pratama
Posted on December 18, 2021
Hi everyone,
I want to learn more about cloud, cloud services, cloud computing, etc. That is why I write up this one. I want to explore more Azure Functions. This is not a tutorial, I just want to take note some problems and what went well when I was exploring the Azure Functions. You want to learn more about Azure Cosmos DB, you can check here
Problems
Azure Functions Problems
ClaimsPrincipal is not filled by Username/Email
This problem took me many days to find the solution. Until now, I still can't figure out why. So, I take workaround. My workaround are read the header X-MS-CLIENT-PRINCIPAL-NAME and activate the Easy Auth. This is a disadvantage, I can't know if my solution works. I need to deploy to the Azure Functions and call it with my client code. I want to minimize test directly to "production" when heavy development time, but I don't have many choice now.
Azure Cosmos DB Problems
The Error Come from EF CosmosDB Provider Little Bit Hard to Understand
As a newcomer at CosmosDB, I think the error little bit hard to understand. When I am not setting up the Container, they only said 404. It is hard for me to know the error context.
Some notes:
Database Name: You will set up this at UseCosmos. This is same with database in CosmosDb.
Collection: When use define DbContext, your DbContext will become Collection. So you need to create it or setup it before.
Can't create Azure Cosmos DB because high demand?
I don't understand for this. Is it really because high demand? I want to provision Azure Cosmos DB at Southeast Asia, but it is always said high demand. So I take workaround to use Azure Cosmos DB free and use different region. It is have different region and quite far from my place. It has huge delay in my application because of this. Anyway, do you want to try Azure Cosmos DB? You can check here.
Show Case
I have some videos when I was exploring the Azure Functions and Azure Cosmos DB. Here we are,
For the next part, I will tell more about the Azure Static Web Apps and deploy the client into there. We will consume the azure functions and use msal as our authentication client.