Search code examples
sql-serverazureazure-cli

Why can't a SQL Server be tagged during the creation in Azure CLI?


According to the docs for az sql server create, there's no way to specify the tags. I can also confirm it because running

az sql server create --resource-group groupy `
   --name sql-sqlserver-v12 `
   --admin-user hakuna --admin-password matata

works, while

az sql server create --resource-group groupy --name sql-sqlserver-v12 `
   --admin-user hakuna --admin-password matata `
   --tags some=thing

fails. It confuses me because it's generally possible to tag up other things during hte creation. Also, there's a field in the returned JSON called tags (being empty now). I also see that the GUI has a way spot to add tags.

What is the reason of such (to me) inconsistent syntax? Is there a reason not to tag up a server? If so, what? If not, how to tag it as per best-practices?


Solution

  • Why is hard to answer.

    You can Tag via inherited tags, https://learn.microsoft.com/en-us/azure/cost-management-billing/costs/enable-tag-inheritance or creation via Infrastructure as Code files (bicep/arm) which provide more consistency.