diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 80579c185..a50d740ef 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -3,6 +3,7 @@ Release Notes ## 1.9.24 * Service Bus: Add validation for SKU-specific features (topics not supported on Basic SKU, max message size only supported on Premium SKU). +* SQL Azure: Support for fractional VCores such as (0.5, 0.75) in Serverless Gen5 databases. * Virtual Machines: Added support for `deleteOption` on VM disks, NICs, and public IP addresses to automatically clean up resources when a VM is deleted. * New builder keywords: `disk_delete_option`, `nic_delete_option`, `public_ip_delete_option` * New convenience keyword: `delete_attached` to set all delete options at once diff --git a/docs/content/api-overview/resources/sql.md b/docs/content/api-overview/resources/sql.md index b5e59c4d4..0b04b7f99 100644 --- a/docs/content/api-overview/resources/sql.md +++ b/docs/content/api-overview/resources/sql.md @@ -48,6 +48,24 @@ The SQL Azure module contains two builders - `sqlServer`, used to create SQL Azu | collation | Sets the collation of the database. | | use_encryption | Enables transparent data encryption of the database. | +#### Serverless Gen5 SKU + +The Serverless Gen5 SKU (`S_Gen5`) supports fractional VCores, allowing you to specify capacity as low as 0.5 or 0.75 VCores for cost-effective serverless databases. You can specify both minimum and maximum capacity: + +```fsharp +// Serverless with fractional VCores +sqlDb { + name "serverlessDb" + sku (GeneralPurpose(S_Gen5(0.5, 2.0))) // min: 0.5 VCores, max: 2.0 VCores +} + +// Serverless with integer VCores (also supported) +sqlDb { + name "serverlessDb2" + sku (GeneralPurpose(S_Gen5(1, 4))) // min: 1 VCore, max: 4 VCores +} +``` + #### Example ##### AD auth not set @@ -78,6 +96,10 @@ let myDatabases = sqlServer { db_size (1024 * 128) hybrid_benefit } + sqlDb { + name "serverlessDb" + sku (GeneralPurpose(S_Gen5(0.5, 2.0))) // Serverless with fractional VCores + } ] } @@ -132,6 +154,10 @@ let myDatabases = sqlServer { db_size (1024 * 128) hybrid_benefit } + sqlDb { + name "serverlessDb" + sku (GeneralPurpose(S_Gen5(0.5, 2.0))) // Serverless with fractional VCores + } ] } diff --git a/samples/scripts/sqlserver.fsx b/samples/scripts/sqlserver.fsx index 80e6d46e1..5cc61d422 100644 --- a/samples/scripts/sqlserver.fsx +++ b/samples/scripts/sqlserver.fsx @@ -42,6 +42,10 @@ let myDatabases = sqlServer { name "serverless4to8cpu" sku (GeneralPurpose(S_Gen5(4, 8))) } + sqlDb { + name "serverlessHalfCore" + sku (GeneralPurpose(S_Gen5(0.5, 2.0))) + } ] } diff --git a/src/Farmer/Common.fs b/src/Farmer/Common.fs index 3ad44478a..760e3e692 100644 --- a/src/Farmer/Common.fs +++ b/src/Farmer/Common.fs @@ -2022,7 +2022,7 @@ module Sql = | Gen5_32 | Gen5_40 | Gen5_80 - | S_Gen5 of CapacityMin: int * CapacityMax: int + | S_Gen5 of CapacityMin: float * CapacityMax: float member this.Name = Reflection.FSharpValue.GetUnionFields(this, typeof) diff --git a/src/Tests/Sql.fs b/src/Tests/Sql.fs index 9ec43c4d0..f61c8e568 100644 --- a/src/Tests/Sql.fs +++ b/src/Tests/Sql.fs @@ -304,6 +304,42 @@ let tests = "Incorrect autoPauseDelay" } + test "Serverless sql supports fractional VCores (0.5 and 0.75)" { + let sql = sqlServer { + name "my38server" + admin_username "isaac" + + add_databases [ + sqlDb { + name "mydb23" + sku (GeneralPurpose(S_Gen5(0.5, 1.0))) + } + ] + } + + let template = arm { + location Location.UKSouth + add_resources [ sql ] + } + + let jsn = template.Template |> Writer.toJson + let jobj = jsn |> Newtonsoft.Json.Linq.JObject.Parse + + Expect.equal + (jobj + .SelectToken("resources[?(@.name=='my38server/mydb23')].sku.capacity") + .ToString()) + "1" + "Incorrect max capacity" + + Expect.equal + (jobj + .SelectToken("resources[?(@.name=='my38server/mydb23')].properties.minCapacity") + .ToString()) + "0.5" + "Incorrect min capacity - should support fractional VCores" + } + test "Must set either SQL Server or AD authentication" { Expect.throws (fun () -> sqlServer { name "test" } |> ignore) "Should throw if no auth set" }