question

SiegfriedHeintze-9929 avatar image
0 Votes"
SiegfriedHeintze-9929 asked NavtejSaini-MSFT commented

How to configure Serverless Azure SQL for Multiple ASP.NET Core web sites with EF Core


I'm planning on hosting single instances of multiple (two for starters) ASP.NET/EF Core Web Sites in Azure Kubernetes and they need databases for persistence. These websites will be code first and not share any data structures. All of these sites will use Azure AD B2C for authentication/authorization. I'll be using multi-instance replica sets for brief demos only.

Normally using on premises SQL server I would just use the TSQL command "CREATE DATABASE" and create a couple of databases for each web site:
(1) services.AddDistributedSqlServerCache
(2) Entity Frame Work domain objects defined in C#

Ah, lets see, did I forget any other databases I might need?

Well I just learned that additional azure serverless SQL databases are not free: azure-sql-single-database-or-elastic-pool.html (I had assumed they were).

Until I can get some funding, I want to minimize my monthly azure bill (perhaps at the expense of performance)... These sites will be just proof of concept and have very little traffic.

So what options do I have? Can I get away with a single database? If so, will the "dotnet ef" tools let me do migrations for each site independently and share a single common database?

What about using the same database for different sites calling AddDistributedSqlServerCache? Can they share?

I was going to ask how to choose elastic pool v single but I see on page 26 of Practical Azure SQL Database for Modern Developers that elastic pool is not an option for serverless.

Wow! I just discovered that I can try cosmos for free! Unfortunately, I don't see cosmos on the list of candidate caches for distributed caching in ASP.NET Core. Does comos have a SQL emulation feature that would allow me to use the function AddDistributedSqlServerCache for free with Cosmos until I get get some funding?

Thanks

Siegfried


azure-sql-databaseazure-ad-b2cdotnet-aspnet-core-generaldotnet-entity-framework-core
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Please let us know if you need any further help.

0 Votes 0 ·

1 Answer

DavidBrowne-msft avatar image
0 Votes"
DavidBrowne-msft answered NavtejSaini-MSFT commented

If you can tolerate the time it takes for a serverless database to start, then you can configure them to auto-shutdown when not in use. Or you can simply install SQL Express on Kubernetes: https://docs.microsoft.com/en-us/sql/linux/tutorial-sql-server-containers-kubernetes?view=sql-server-ver15

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@SiegfriedHeintze-9929 With free account the some of resources are free monthly for 12 months. More details here.

87457-image.png

Were you able to check the above methods to create the DB.

Regards
Navtej S

0 Votes 0 ·
image.png (9.4 KiB)