Blazor WASM Static Web App communicate directly with CosmosDB without azure functions

339 Views Asked by At

I've been getting a little lost down the rabbit hole of all things azure and blazor and I could use a little direction.

I'd like to create a blazor web assembly application that can deploy to an azure static web app where the application can communicate directly to cosmos db from the users browser without an azure function as it should speed up the response a bit.

I know there are issues with using the standard cosmos db client code since I will get cors errors.

It looks like there might be some workaround for that by generating a token based on a azure active directory user?

It seems like communicating directly with cosmos db from the browser would be ideal since it follows the whole faster serverless web approach but i'm just not sure the best way to accomplish this.

Is this something microsoft even wants us to do? Seems like everything is pushing towards servers and functions but if we had a client id and secret i dont think those would be needed...

1

There are 1 best solutions below

5
On

You can try out the new toolset that we have added , Data API builder which has integration with Azure Static Web apps to build your Graphql endpoints on top of Azure Cosmos DB .

You just need to provide the schema of the Cosmos DB collection and link the database rest is done automatically by the feature.