A completely serverless solution to access Cosmos DB from Blazor WebAssembly using EF Core.
To configure your application and learn more, read:
Azure AD Secured Serverless Cosmos DB from Blazor WebAssembly
- Optional: fork the repo
git clone https://github.com/jeremylikness/AzureBlazorCosmosWasm.git
(or your fork)- Create an app registration for the Blazor app (there is an Azure CLI script for this linked in the comments of the blog post)
- Update
wwwroot/appsettings.json
in the Blazor WebAssembly client to use the tenant (directory) and client id - Create a Cosmos DB database and seed some initial values
- Deploy the Azure Functions app
- Add the Cosmos DB connection string as "CosmosConnection" under connection strings for the Azure Functions app
- Update authentication for the Azure Functions app to use Azure AD
- Update
wwwroot/appsettings.json
in the Blazor WebAssembly project to point to your functions app (under "TokenClient: Endpoint") - Run it!