1
+ metadata description = 'Creates an Azure Database for MySQL - Flexible Server.'
1
2
param name string
2
3
param location string = resourceGroup ().location
3
4
param tags object = {}
4
5
5
6
param sku object
6
7
param storage object
7
- @description ('Database administrator login name' )
8
- @minLength (1 )
9
- param adminName string = 'mySqlAdmin'
8
+ param administratorLogin string
10
9
@secure ()
11
- param adminPassword string
10
+ param administratorLoginPassword string
11
+ param highAvailabilityMode string = 'Disabled'
12
12
param databaseNames array = []
13
13
param allowAzureIPsFirewall bool = false
14
14
param allowAllIPsFirewall bool = false
15
15
param allowedSingleIPs array = []
16
16
17
- @description ('MySQL version' )
18
- @allowed ([
19
- '5.7'
20
- '8.0.21'
21
- ])
22
- param version string = '8.0.21'
23
-
24
- @allowed ([
25
- 'Disabled'
26
- 'ZoneRedundant'
27
- 'SameZone'
28
- ])
29
- param highAvailabilityMode string = 'Disabled'
17
+ // MySQL version
18
+ param version string
30
19
31
- resource mysqlServer 'Microsoft.DBforMySQL/flexibleServers@2021-05-01 ' = {
20
+ resource mysqlServer 'Microsoft.DBforMySQL/flexibleServers@2023-06-30 ' = {
32
21
location : location
33
22
tags : tags
34
23
name : name
35
24
sku : sku
36
25
properties : {
37
26
version : version
38
- administratorLogin : adminName
39
- administratorLoginPassword : adminPassword
27
+ administratorLogin : administratorLogin
28
+ administratorLoginPassword : administratorLoginPassword
40
29
storage : storage
41
30
highAvailability : {
42
31
mode : highAvailabilityMode
@@ -45,33 +34,29 @@ resource mysqlServer 'Microsoft.DBforMySQL/flexibleServers@2021-05-01' = {
45
34
46
35
resource database 'databases' = [for name in databaseNames : {
47
36
name : name
48
- properties : {
49
- charset : 'utf8'
50
- collation : 'utf8_general_ci'
51
- }
52
37
}]
53
38
54
39
resource firewall_all 'firewallRules' = if (allowAllIPsFirewall ) {
55
40
name : 'allow-all-IPs'
56
41
properties : {
57
- startIpAddress : '0.0.0.0'
58
- endIpAddress : '255.255.255.255'
42
+ startIpAddress : '0.0.0.0'
43
+ endIpAddress : '255.255.255.255'
59
44
}
60
45
}
61
46
62
47
resource firewall_azure 'firewallRules' = if (allowAzureIPsFirewall ) {
63
48
name : 'allow-all-azure-internal-IPs'
64
49
properties : {
65
- startIpAddress : '0.0.0.0'
66
- endIpAddress : '0.0.0.0'
50
+ startIpAddress : '0.0.0.0'
51
+ endIpAddress : '0.0.0.0'
67
52
}
68
53
}
69
54
70
55
resource firewall_single 'firewallRules' = [for ip in allowedSingleIPs : {
71
56
name : 'allow-single-${replace (ip , '.' , '' )}'
72
57
properties : {
73
- startIpAddress : ip
74
- endIpAddress : ip
58
+ startIpAddress : ip
59
+ endIpAddress : ip
75
60
}
76
61
}]
77
62
0 commit comments