Skip to content

Commit 6111e47

Browse files
authored
Support fractional VCores for Azure SQL Database Serverless (#1223)
1 parent 31470da commit 6111e47

File tree

5 files changed

+68
-1
lines changed

5 files changed

+68
-1
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Release Notes
33

44
## 1.9.24
55
* Service Bus: Add validation for SKU-specific features (topics not supported on Basic SKU, max message size only supported on Premium SKU).
6+
* SQL Azure: Support for fractional VCores such as (0.5, 0.75) in Serverless Gen5 databases.
67
* Virtual Machines: Added support for `deleteOption` on VM disks, NICs, and public IP addresses to automatically clean up resources when a VM is deleted.
78
* New builder keywords: `disk_delete_option`, `nic_delete_option`, `public_ip_delete_option`
89
* New convenience keyword: `delete_attached` to set all delete options at once

docs/content/api-overview/resources/sql.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,24 @@ The SQL Azure module contains two builders - `sqlServer`, used to create SQL Azu
4848
| collation | Sets the collation of the database. |
4949
| use_encryption | Enables transparent data encryption of the database. |
5050

51+
#### Serverless Gen5 SKU
52+
53+
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:
54+
55+
```fsharp
56+
// Serverless with fractional VCores
57+
sqlDb {
58+
name "serverlessDb"
59+
sku (GeneralPurpose(S_Gen5(0.5, 2.0))) // min: 0.5 VCores, max: 2.0 VCores
60+
}
61+
62+
// Serverless with integer VCores (also supported)
63+
sqlDb {
64+
name "serverlessDb2"
65+
sku (GeneralPurpose(S_Gen5(1, 4))) // min: 1 VCore, max: 4 VCores
66+
}
67+
```
68+
5169
#### Example
5270

5371
##### AD auth not set
@@ -78,6 +96,10 @@ let myDatabases = sqlServer {
7896
db_size (1024<Mb> * 128)
7997
hybrid_benefit
8098
}
99+
sqlDb {
100+
name "serverlessDb"
101+
sku (GeneralPurpose(S_Gen5(0.5, 2.0))) // Serverless with fractional VCores
102+
}
81103
]
82104
}
83105
@@ -132,6 +154,10 @@ let myDatabases = sqlServer {
132154
db_size (1024<Mb> * 128)
133155
hybrid_benefit
134156
}
157+
sqlDb {
158+
name "serverlessDb"
159+
sku (GeneralPurpose(S_Gen5(0.5, 2.0))) // Serverless with fractional VCores
160+
}
135161
]
136162
}
137163

samples/scripts/sqlserver.fsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ let myDatabases = sqlServer {
4242
name "serverless4to8cpu"
4343
sku (GeneralPurpose(S_Gen5(4, 8)))
4444
}
45+
sqlDb {
46+
name "serverlessHalfCore"
47+
sku (GeneralPurpose(S_Gen5(0.5, 2.0)))
48+
}
4549
]
4650
}
4751

src/Farmer/Common.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2022,7 +2022,7 @@ module Sql =
20222022
| Gen5_32
20232023
| Gen5_40
20242024
| Gen5_80
2025-
| S_Gen5 of CapacityMin: int * CapacityMax: int
2025+
| S_Gen5 of CapacityMin: float * CapacityMax: float
20262026

20272027
member this.Name =
20282028
Reflection.FSharpValue.GetUnionFields(this, typeof<Gen5Series>)

src/Tests/Sql.fs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,42 @@ let tests =
304304
"Incorrect autoPauseDelay"
305305
}
306306

307+
test "Serverless sql supports fractional VCores (0.5 and 0.75)" {
308+
let sql = sqlServer {
309+
name "my38server"
310+
admin_username "isaac"
311+
312+
add_databases [
313+
sqlDb {
314+
name "mydb23"
315+
sku (GeneralPurpose(S_Gen5(0.5, 1.0)))
316+
}
317+
]
318+
}
319+
320+
let template = arm {
321+
location Location.UKSouth
322+
add_resources [ sql ]
323+
}
324+
325+
let jsn = template.Template |> Writer.toJson
326+
let jobj = jsn |> Newtonsoft.Json.Linq.JObject.Parse
327+
328+
Expect.equal
329+
(jobj
330+
.SelectToken("resources[?(@.name=='my38server/mydb23')].sku.capacity")
331+
.ToString())
332+
"1"
333+
"Incorrect max capacity"
334+
335+
Expect.equal
336+
(jobj
337+
.SelectToken("resources[?(@.name=='my38server/mydb23')].properties.minCapacity")
338+
.ToString())
339+
"0.5"
340+
"Incorrect min capacity - should support fractional VCores"
341+
}
342+
307343
test "Must set either SQL Server or AD authentication" {
308344
Expect.throws (fun () -> sqlServer { name "test" } |> ignore) "Should throw if no auth set"
309345
}

0 commit comments

Comments
 (0)