0

I'm creating a microservices architecture.

Each service needs its own database, so I've created an SQL Server resource in my Azure's Resource Group.

But the databases are created code-first by the services when they are deployed.

In Azure, it results with a newly created database attached to my SQL Server, and so in my Resource Group. Exactly what I want.

But unfortunately, the database configuration is the raw default of Azure, with 32GB and costs me a lot more money than it should.

I don't need more than 100mb per database and I can even pick the "serverless" Computer tier option to pay lesser.

So I've created a template of database and now I'm trying to assign it as the default template used by the SQL Server resource whenever a microservice creates a new database.

Is it even possible ?

3
  • 1
    Hi M. Ozn, and welcome to devops.stackexchange. What I'd recommend is making your pipeline deploy the fresh database with an arm template, and having your microservice follow up by filling out the schema etc. Would that be a possibility for you? Dec 16, 2021 at 16:15
  • Sounds great ! I'll try it out. Thanks for the idea !
    – M. Ozn
    Dec 17, 2021 at 18:18
  • I've posted it as an answer; I hope it works for you Dec 18, 2021 at 9:32

1 Answer 1

1

ARM is the natural tool for templating an azure resource. I'd suggest structuring your solution so that:

  1. your DB is deployed using an arm or bicep template, using the Microsoft.Sql/servers/databases resource type. That gives you the control to assign a database size, or include it in a different tier, etc.

  2. your microservice follows up by taking the fresh database and building out the schema but without affecting the database size etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.