<p>ARM is the natural tool for templating an azure resource. I'd suggest structuring your solution so that:</p>
<ol>
<li><p>your DB is deployed using an arm or bicep template, using the <a href="https://docs.microsoft.com/en-us/azure/templates/microsoft.sql/servers/databases?tabs=bicep" rel="nofollow noreferrer">Microsoft.Sql/servers/databases</a> resource type. That gives you the control to assign a database size, or include it in a different tier, etc.</p>
</li>
<li><p>your microservice follows up by taking the fresh database and building out the schema but without affecting the database size etc.</p>
</li>
</ol>

CC BY-SA 4.0
2021-12-18T09:31:43.240Z
2021-12-18T09:31:43.240Z
Vince Bowdren
<p>I'm creating a microservices architecture.</p>
<p>Each service needs its own database, so I've created an SQL Server resource in my Azure's Resource Group.</p>
<p>But the databases are created code-first by the services when they are deployed.</p>
<p>In Azure, it results with a newly created database attached to my SQL Server, and so in my Resource Group. Exactly what I want.</p>
<p>But unfortunately, the database configuration is the raw default of Azure, with 32GB and costs me a lot more money than it should.</p>
<p>I don't need more than 100mb per database and I can even pick the &quot;serverless&quot; Computer tier option to pay lesser.</p>
<p>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.</p>
<p>Is it even possible ?</p>

CC BY-SA 4.0
2021-12-16T16:15:50.527Z
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?
Vince Bowdren
CC BY-SA 4.0
2021-12-17T18:18:38.217Z
Sounds great ! I'll try it out. Thanks for the idea !
M. Ozn
CC BY-SA 4.0
2021-12-18T09:32:55.603Z
I've posted it as an answer; I hope it works for you
Vince Bowdren
<azure-devops><sql>
SQL Server database default template
M. Ozn
# SQL Server database default template

(Asked by: username_0 on 2021-12-09)

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 ?

**Tags:** azure-devops, sql

> **Comments:**
> **username_1**: Hi username_0, 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?  
> **username_0**: Sounds great ! I'll try it out. Thanks for the idea !  
> **username_1**: I've posted it as an answer; I hope it works for you  

---

## 1 answers

### Answer by username_1 on 2021-12-18. Score: 1 | Accepted answer

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](https://docs.microsoft.com/en-us/azure/templates/microsoft.sql/servers/databases?tabs=bicep) 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.


---

