Skip to content

Commit

Permalink
[Modules] Update the SQL - Server module API version to the latest do…
Browse files Browse the repository at this point in the history
…cumented version (#4102)

* [Modules] Updated SQL Server API to latest documented

* jsons

* updated readme
  • Loading branch information
ahmadabdalla authored Oct 17, 2023
1 parent 5b43f91 commit 507d8c0
Show file tree
Hide file tree
Showing 24 changed files with 99 additions and 55 deletions.
2 changes: 1 addition & 1 deletion modules/sql/server/.bicep/nested_roleAssignments.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var builtInRoleNames = {
'User Access Administrator': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '18d7d88d-d35e-4fb5-a5c3-7773c20a72d9')
}

resource server 'Microsoft.Sql/servers@2022-02-01-preview' existing = {
resource server 'Microsoft.Sql/servers@2022-05-01-preview' existing = {
name: last(split(resourceId, '/'))!
}

Expand Down
14 changes: 7 additions & 7 deletions modules/sql/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ This module deploys an Azure SQL Server.
| `Microsoft.Network/privateEndpoints` | [2023-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Network/2023-04-01/privateEndpoints) |
| `Microsoft.Network/privateEndpoints/privateDnsZoneGroups` | [2023-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Network/2023-04-01/privateEndpoints/privateDnsZoneGroups) |
| `Microsoft.Sql/servers` | [2022-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2022-05-01-preview/servers) |
| `Microsoft.Sql/servers/databases` | [2021-11-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2021-11-01/servers/databases) |
| `Microsoft.Sql/servers/databases` | [2022-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2022-05-01-preview/servers/databases) |
| `Microsoft.Sql/servers/databases/backupLongTermRetentionPolicies` | [2022-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2022-05-01-preview/servers/databases/backupLongTermRetentionPolicies) |
| `Microsoft.Sql/servers/databases/backupShortTermRetentionPolicies` | [2022-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2022-05-01-preview/servers/databases/backupShortTermRetentionPolicies) |
| `Microsoft.Sql/servers/elasticPools` | [2022-02-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2022-02-01-preview/servers/elasticPools) |
| `Microsoft.Sql/servers/encryptionProtector` | [2022-08-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/servers/encryptionProtector) |
| `Microsoft.Sql/servers/firewallRules` | [2022-02-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2022-02-01-preview/servers/firewallRules) |
| `Microsoft.Sql/servers/elasticPools` | [2022-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2022-05-01-preview/servers/elasticPools) |
| `Microsoft.Sql/servers/encryptionProtector` | [2022-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2022-05-01-preview/servers/encryptionProtector) |
| `Microsoft.Sql/servers/firewallRules` | [2022-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2022-05-01-preview/servers/firewallRules) |
| `Microsoft.Sql/servers/keys` | [2022-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2022-05-01-preview/servers/keys) |
| `Microsoft.Sql/servers/securityAlertPolicies` | [2022-02-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2022-02-01-preview/servers/securityAlertPolicies) |
| `Microsoft.Sql/servers/virtualNetworkRules` | [2022-02-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2022-02-01-preview/servers/virtualNetworkRules) |
| `Microsoft.Sql/servers/vulnerabilityAssessments` | [2022-02-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2022-02-01-preview/servers/vulnerabilityAssessments) |
| `Microsoft.Sql/servers/securityAlertPolicies` | [2022-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2022-05-01-preview/servers/securityAlertPolicies) |
| `Microsoft.Sql/servers/virtualNetworkRules` | [2022-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2022-05-01-preview/servers/virtualNetworkRules) |
| `Microsoft.Sql/servers/vulnerabilityAssessments` | [2022-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2022-05-01-preview/servers/vulnerabilityAssessments) |

## Usage examples

Expand Down
11 changes: 10 additions & 1 deletion modules/sql/server/database/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This module deploys an Azure SQL Server Database.
| Resource Type | API Version |
| :-- | :-- |
| `Microsoft.Insights/diagnosticSettings` | [2021-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Insights/2021-05-01-preview/diagnosticSettings) |
| `Microsoft.Sql/servers/databases` | [2021-11-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2021-11-01/servers/databases) |
| `Microsoft.Sql/servers/databases` | [2022-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2022-05-01-preview/servers/databases) |
| `Microsoft.Sql/servers/databases/backupLongTermRetentionPolicies` | [2022-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2022-05-01-preview/servers/databases/backupLongTermRetentionPolicies) |
| `Microsoft.Sql/servers/databases/backupShortTermRetentionPolicies` | [2022-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2022-05-01-preview/servers/databases/backupShortTermRetentionPolicies) |

Expand Down Expand Up @@ -57,6 +57,7 @@ This module deploys an Azure SQL Server Database.
| [`maintenanceConfigurationId`](#parameter-maintenanceconfigurationid) | string | Maintenance configuration ID assigned to the database. This configuration defines the period when the maintenance updates will occur. |
| [`maxSizeBytes`](#parameter-maxsizebytes) | int | The max size of the database expressed in bytes. |
| [`minCapacity`](#parameter-mincapacity) | string | Minimal capacity that database will always have allocated. |
| [`preferredEnclaveType`](#parameter-preferredenclavetype) | string | Type of enclave requested on the database i.e. Default or VBS enclaves. |
| [`readScale`](#parameter-readscale) | string | The state of read-only routing. |
| [`recoveryServicesRecoveryPointResourceId`](#parameter-recoveryservicesrecoverypointresourceid) | string | Resource ID of backup if createMode set to RestoreLongTermRetentionBackup. |
| [`requestedBackupStorageRedundancy`](#parameter-requestedbackupstorageredundancy) | string | The storage account type to be used to store backups for this database. |
Expand Down Expand Up @@ -228,6 +229,14 @@ The name of the database.
- Required: Yes
- Type: string

### Parameter: `preferredEnclaveType`

Type of enclave requested on the database i.e. Default or VBS enclaves.
- Required: No
- Type: string
- Default: `''`
- Allowed: `['', Default, VBS]`

### Parameter: `readScale`

The state of read-only routing.
Expand Down
13 changes: 11 additions & 2 deletions modules/sql/server/database/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ param skuName string = 'GP_Gen5_2'
@description('Optional. Capacity of the particular SKU.')
param skuCapacity int = -1

@description('Optional. Type of enclave requested on the database i.e. Default or VBS enclaves.')
@allowed([
''
'Default'
'VBS'
])
param preferredEnclaveType string = ''

@description('Optional. If the service has different generations of hardware, for the same SKU, then that can be captured here.')
param skuFamily string = ''

Expand Down Expand Up @@ -202,16 +210,17 @@ resource defaultTelemetry 'Microsoft.Resources/deployments@2021-04-01' = if (ena
}
}

resource server 'Microsoft.Sql/servers@2021-11-01' existing = {
resource server 'Microsoft.Sql/servers@2022-05-01-preview' existing = {
name: serverName
}

resource database 'Microsoft.Sql/servers/databases@2021-11-01' = {
resource database 'Microsoft.Sql/servers/databases@2022-05-01-preview' = {
name: name
parent: server
location: location
tags: tags
properties: {
preferredEnclaveType: !empty(preferredEnclaveType) ? preferredEnclaveType : null
collation: collation
maxSizeBytes: maxSizeBytes
sampleName: sampleName
Expand Down
19 changes: 16 additions & 3 deletions modules/sql/server/database/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"_generator": {
"name": "bicep",
"version": "0.22.6.54827",
"templateHash": "7000207485744795208"
"templateHash": "14921090017328805601"
},
"name": "SQL Server Database",
"description": "This module deploys an Azure SQL Server Database.",
Expand Down Expand Up @@ -52,6 +52,18 @@
"description": "Optional. Capacity of the particular SKU."
}
},
"preferredEnclaveType": {
"type": "string",
"defaultValue": "",
"allowedValues": [
"",
"Default",
"VBS"
],
"metadata": {
"description": "Optional. Type of enclave requested on the database i.e. Default or VBS enclaves."
}
},
"skuFamily": {
"type": "string",
"defaultValue": "",
Expand Down Expand Up @@ -356,11 +368,12 @@
},
{
"type": "Microsoft.Sql/servers/databases",
"apiVersion": "2021-11-01",
"apiVersion": "2022-05-01-preview",
"name": "[format('{0}/{1}', parameters('serverName'), parameters('name'))]",
"location": "[parameters('location')]",
"tags": "[parameters('tags')]",
"properties": {
"preferredEnclaveType": "[if(not(empty(parameters('preferredEnclaveType'))), parameters('preferredEnclaveType'), null())]",
"collation": "[parameters('collation')]",
"maxSizeBytes": "[parameters('maxSizeBytes')]",
"sampleName": "[parameters('sampleName')]",
Expand Down Expand Up @@ -688,7 +701,7 @@
"metadata": {
"description": "The location the resource was deployed into."
},
"value": "[reference(resourceId('Microsoft.Sql/servers/databases', parameters('serverName'), parameters('name')), '2021-11-01', 'full').location]"
"value": "[reference(resourceId('Microsoft.Sql/servers/databases', parameters('serverName'), parameters('name')), '2022-05-01-preview', 'full').location]"
}
}
}
2 changes: 1 addition & 1 deletion modules/sql/server/elastic-pool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This module deploys an Azure SQL Server Elastic Pool.

| Resource Type | API Version |
| :-- | :-- |
| `Microsoft.Sql/servers/elasticPools` | [2022-02-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2022-02-01-preview/servers/elasticPools) |
| `Microsoft.Sql/servers/elasticPools` | [2022-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2022-05-01-preview/servers/elasticPools) |

## Parameters

Expand Down
4 changes: 2 additions & 2 deletions modules/sql/server/elastic-pool/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ resource defaultTelemetry 'Microsoft.Resources/deployments@2021-04-01' = if (ena
}
}

resource server 'Microsoft.Sql/servers@2021-11-01' existing = {
resource server 'Microsoft.Sql/servers@2022-05-01-preview' existing = {
name: serverName
}

resource elasticPool 'Microsoft.Sql/servers/elasticPools@2022-02-01-preview' = {
resource elasticPool 'Microsoft.Sql/servers/elasticPools@2022-05-01-preview' = {
name: name
location: location
parent: server
Expand Down
6 changes: 3 additions & 3 deletions modules/sql/server/elastic-pool/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"_generator": {
"name": "bicep",
"version": "0.22.6.54827",
"templateHash": "1361594412163336206"
"templateHash": "2069769222124842536"
},
"name": "SQL Server Elastic Pool",
"description": "This module deploys an Azure SQL Server Elastic Pool.",
Expand Down Expand Up @@ -144,7 +144,7 @@
},
{
"type": "Microsoft.Sql/servers/elasticPools",
"apiVersion": "2022-02-01-preview",
"apiVersion": "2022-05-01-preview",
"name": "[format('{0}/{1}', parameters('serverName'), parameters('name'))]",
"location": "[parameters('location')]",
"tags": "[parameters('tags')]",
Expand Down Expand Up @@ -194,7 +194,7 @@
"metadata": {
"description": "The location the resource was deployed into."
},
"value": "[reference(resourceId('Microsoft.Sql/servers/elasticPools', parameters('serverName'), parameters('name')), '2022-02-01-preview', 'full').location]"
"value": "[reference(resourceId('Microsoft.Sql/servers/elasticPools', parameters('serverName'), parameters('name')), '2022-05-01-preview', 'full').location]"
}
}
}
2 changes: 1 addition & 1 deletion modules/sql/server/encryption-protector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This module deploys an Azure SQL Server Encryption Protector.

| Resource Type | API Version |
| :-- | :-- |
| `Microsoft.Sql/servers/encryptionProtector` | [2022-08-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/servers/encryptionProtector) |
| `Microsoft.Sql/servers/encryptionProtector` | [2022-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2022-05-01-preview/servers/encryptionProtector) |

## Parameters

Expand Down
4 changes: 2 additions & 2 deletions modules/sql/server/encryption-protector/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ resource defaultTelemetry 'Microsoft.Resources/deployments@2021-04-01' = if (ena
}
}

resource sqlServer 'Microsoft.Sql/servers@2022-08-01-preview' existing = {
resource sqlServer 'Microsoft.Sql/servers@2022-05-01-preview' existing = {
name: sqlServerName
}

resource encryptionProtector 'Microsoft.Sql/servers/encryptionProtector@2022-08-01-preview' = {
resource encryptionProtector 'Microsoft.Sql/servers/encryptionProtector@2022-05-01-preview' = {
name: 'current'
parent: sqlServer
properties: {
Expand Down
4 changes: 2 additions & 2 deletions modules/sql/server/encryption-protector/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"_generator": {
"name": "bicep",
"version": "0.22.6.54827",
"templateHash": "1128739845456097575"
"templateHash": "17224807912051676418"
},
"name": "Azure SQL Server Encryption Protector",
"description": "This module deploys an Azure SQL Server Encryption Protector.",
Expand Down Expand Up @@ -67,7 +67,7 @@
},
{
"type": "Microsoft.Sql/servers/encryptionProtector",
"apiVersion": "2022-08-01-preview",
"apiVersion": "2022-05-01-preview",
"name": "[format('{0}/{1}', parameters('sqlServerName'), 'current')]",
"properties": {
"serverKeyType": "[parameters('serverKeyType')]",
Expand Down
2 changes: 1 addition & 1 deletion modules/sql/server/firewall-rule/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This module deploys an Azure SQL Server Firewall Rule.

| Resource Type | API Version |
| :-- | :-- |
| `Microsoft.Sql/servers/firewallRules` | [2022-02-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2022-02-01-preview/servers/firewallRules) |
| `Microsoft.Sql/servers/firewallRules` | [2022-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Sql/2022-05-01-preview/servers/firewallRules) |

## Parameters

Expand Down
4 changes: 2 additions & 2 deletions modules/sql/server/firewall-rule/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ resource defaultTelemetry 'Microsoft.Resources/deployments@2021-04-01' = if (ena
}
}

resource server 'Microsoft.Sql/servers@2022-02-01-preview' existing = {
resource server 'Microsoft.Sql/servers@2022-05-01-preview' existing = {
name: serverName
}

resource firewallRule 'Microsoft.Sql/servers/firewallRules@2022-02-01-preview' = {
resource firewallRule 'Microsoft.Sql/servers/firewallRules@2022-05-01-preview' = {
name: name
parent: server
properties: {
Expand Down
4 changes: 2 additions & 2 deletions modules/sql/server/firewall-rule/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"_generator": {
"name": "bicep",
"version": "0.22.6.54827",
"templateHash": "17694214441241917212"
"templateHash": "17045860485834879442"
},
"name": "Azure SQL Server Firewall Rule",
"description": "This module deploys an Azure SQL Server Firewall Rule.",
Expand Down Expand Up @@ -63,7 +63,7 @@
},
{
"type": "Microsoft.Sql/servers/firewallRules",
"apiVersion": "2022-02-01-preview",
"apiVersion": "2022-05-01-preview",
"name": "[format('{0}/{1}', parameters('serverName'), parameters('name'))]",
"properties": {
"endIpAddress": "[parameters('endIpAddress')]",
Expand Down
33 changes: 23 additions & 10 deletions modules/sql/server/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,18 @@
"description": "Optional. Capacity of the particular SKU."
}
},
"preferredEnclaveType": {
"type": "string",
"defaultValue": "",
"allowedValues": [
"",
"Default",
"VBS"
],
"metadata": {
"description": "Optional. Type of enclave requested on the database i.e. Default or VBS enclaves."
}
},
"skuFamily": {
"type": "string",
"defaultValue": "",
Expand Down Expand Up @@ -825,11 +837,12 @@
},
{
"type": "Microsoft.Sql/servers/databases",
"apiVersion": "2021-11-01",
"apiVersion": "2022-05-01-preview",
"name": "[format('{0}/{1}', parameters('serverName'), parameters('name'))]",
"location": "[parameters('location')]",
"tags": "[parameters('tags')]",
"properties": {
"preferredEnclaveType": "[if(not(empty(parameters('preferredEnclaveType'))), parameters('preferredEnclaveType'), null())]",
"collation": "[parameters('collation')]",
"maxSizeBytes": "[parameters('maxSizeBytes')]",
"sampleName": "[parameters('sampleName')]",
Expand Down Expand Up @@ -1157,7 +1170,7 @@
"metadata": {
"description": "The location the resource was deployed into."
},
"value": "[reference(resourceId('Microsoft.Sql/servers/databases', parameters('serverName'), parameters('name')), '2021-11-01', 'full').location]"
"value": "[reference(resourceId('Microsoft.Sql/servers/databases', parameters('serverName'), parameters('name')), '2022-05-01-preview', 'full').location]"
}
}
}
Expand Down Expand Up @@ -1352,7 +1365,7 @@
},
{
"type": "Microsoft.Sql/servers/elasticPools",
"apiVersion": "2022-02-01-preview",
"apiVersion": "2022-05-01-preview",
"name": "[format('{0}/{1}', parameters('serverName'), parameters('name'))]",
"location": "[parameters('location')]",
"tags": "[parameters('tags')]",
Expand Down Expand Up @@ -1402,7 +1415,7 @@
"metadata": {
"description": "The location the resource was deployed into."
},
"value": "[reference(resourceId('Microsoft.Sql/servers/elasticPools', parameters('serverName'), parameters('name')), '2022-02-01-preview', 'full').location]"
"value": "[reference(resourceId('Microsoft.Sql/servers/elasticPools', parameters('serverName'), parameters('name')), '2022-05-01-preview', 'full').location]"
}
}
}
Expand Down Expand Up @@ -2066,7 +2079,7 @@
},
{
"type": "Microsoft.Sql/servers/firewallRules",
"apiVersion": "2022-02-01-preview",
"apiVersion": "2022-05-01-preview",
"name": "[format('{0}/{1}', parameters('serverName'), parameters('name'))]",
"properties": {
"endIpAddress": "[parameters('endIpAddress')]",
Expand Down Expand Up @@ -2195,7 +2208,7 @@
},
{
"type": "Microsoft.Sql/servers/virtualNetworkRules",
"apiVersion": "2022-02-01-preview",
"apiVersion": "2022-05-01-preview",
"name": "[format('{0}/{1}', parameters('serverName'), parameters('name'))]",
"properties": {
"ignoreMissingVnetServiceEndpoint": "[parameters('ignoreMissingVnetServiceEndpoint')]",
Expand Down Expand Up @@ -2367,7 +2380,7 @@
},
{
"type": "Microsoft.Sql/servers/securityAlertPolicies",
"apiVersion": "2022-02-01-preview",
"apiVersion": "2022-05-01-preview",
"name": "[format('{0}/{1}', parameters('serverName'), parameters('name'))]",
"properties": {
"disabledAlerts": "[parameters('disabledAlerts')]",
Expand Down Expand Up @@ -2513,7 +2526,7 @@
},
{
"type": "Microsoft.Sql/servers/vulnerabilityAssessments",
"apiVersion": "2022-02-01-preview",
"apiVersion": "2022-05-01-preview",
"name": "[format('{0}/{1}', parameters('serverName'), parameters('name'))]",
"properties": {
"storageContainerPath": "[format('https://{0}.blob.{1}/vulnerability-assessment/', last(split(parameters('storageAccountResourceId'), '/')), environment().suffixes.storage)]",
Expand Down Expand Up @@ -2784,7 +2797,7 @@
},
{
"type": "Microsoft.Sql/servers/encryptionProtector",
"apiVersion": "2022-08-01-preview",
"apiVersion": "2022-05-01-preview",
"name": "[format('{0}/{1}', parameters('sqlServerName'), 'current')]",
"properties": {
"serverKeyType": "[parameters('serverKeyType')]",
Expand Down Expand Up @@ -2861,4 +2874,4 @@
"value": "[reference(resourceId('Microsoft.Sql/servers', parameters('name')), '2022-05-01-preview', 'full').location]"
}
}
}
}
Loading

0 comments on commit 507d8c0

Please sign in to comment.