Azure / azure-quickstart-templates

Azure Quickstart Templates
https://aka.ms/azqst
MIT License
14.07k stars 16.13k forks source link

Modern Versions of Windows and SQL (2022/2019) #12056

Open eriqs opened 2 years ago

eriqs commented 2 years ago

I really like this template, and it could come in very handy for some things that I am currently working on, but I need the ability to use modern versions of Windows and SQL Server, ideally Windows Server 2022 and the latest version of SQL Server. I have tried modifying the template but am struggling to get it working. Would it be possible to add functionality to allow the selection of different OS and SQL versions? I see the 'Sql Server Version' field which defaults to 'SQL2014SP2-WS2012R2', but when I change that to a more recent valid offer like 'sql2019-ws2022' I get an error that the offer can't be found even though I see it when I run Get-AzVMImageOffer.

jbpaux commented 2 years ago

Hi, which template are you talking about ?

eriqs commented 2 years ago

Apologies for not specifying, this is related to the sqlvm-alwayson-cluster template. It currently deploys VMs that are running Windows Server 2012 R2 with SQL Server 2014 installed. I need the same environment, but I need to use modern versions of the OS and SQL (2022 and/or 2019).

When I deploy the template, one of the parameter fields asks for the "Sql Server version" and the default value is "SQL2014SP2-WS2012R2". I ran the Get-AzVMImageOffer and see that "sql2019-ws2022" is listed as an option, but if I put that in the "Sql Server version" field the deployment fails because of "Unable to process template language expressions" with "The template variable 'sql2019-ws2022' is not found."

I can see the image offering in Az PowerShell:

Get-AzVMImageOffer -Location $Location -PublisherName MicrosoftSQLServer | ? {$_.Offer -Match "22"} | ft Offer,PublisherName,Location

Offer          PublisherName      Location      
---          -------------      --------   ----          -------------      --------      
sql2019-ws2022 MicrosoftSQLServer southcentralus

If I leave the default SQL Server version (SQL2014SP2-WS2012R2) I am able to deploy the template successfully, but I cannot use Windows Server 2012 R2 for this project so I am hoping that I can use this template to deploy the latest versions of the OS and SQL.

jbpaux commented 2 years ago

After line 298 of azuredeploy.json file you can add : "sql2019-ws2022": "Enterprise", and it should work However the template is from my point of view not really clean and should be reworked.