-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.bicep
128 lines (115 loc) · 3.09 KB
/
main.bicep
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/* Nesse template, cria o WebApp, o ServicePlan, dá um push do WordPress lá do GitHub, Cria o MySQL Server, a database,
bem como a regra de firewall no MySQL, e configura os hostnames do dominio personalizado */
param location string = resourceGroup().location
param webAppName string = 'azuretar${uniqueString(resourceGroup().id)}'
param MySQLServerName string = 'azuretarMySQL'
param appServicePlanName string = 'azuretarDemoWP'
param DBName string = 'azuretar'
param subDomain string = 'www'
param Domain string
@secure()
param administratorLogin string
@secure()
param administratorLoginPassword string
var charset = 'utf8'
var collation = 'utf8_general_ci'
resource appServicePlan 'Microsoft.Web/serverfarms@2020-12-01' = {
name: appServicePlanName
location: location
sku: {
name: 'B1'
capacity: 1
}
}
resource webApp 'Microsoft.Web/sites@2020-06-01' = {
name: webAppName
location: location
properties: {
serverFarmId: appServicePlan.id
clientAffinityEnabled:true
httpsOnly: true
siteConfig:{
appSettings:[
{
name:'DATABASE_HOST'
value:'P:DATABASEHOST: 3306'
}
{
name:'PHPMYADMIN_EXTENSION_VERSION'
value: 'latest'
}
]
connectionStrings:[
{
name:'defaultConnection'
connectionString:'Database=${DBName};Data Source=${MySQLServerName}.mysql.database.azure.com;User Id=${administratorLogin}@${MySQLServerName};Password=${administratorLoginPassword}'
type:'MySql'
}
]
phpVersion:'7.4'
netFrameworkVersion:'v4.0'
}
}
dependsOn:[
mySQLdb
]
}
resource WordPress 'Microsoft.Web/sites/sourcecontrols@2021-02-01' ={
name: 'web'
parent:webApp
properties:{
repoUrl:'https://github.com/azureappserviceoss/wordpress-azure'
branch:'master'
isManualIntegration:true
}
}
resource mySQLdb 'Microsoft.DBforMySQL/servers@2017-12-01' = {
name: MySQLServerName
location: location
tags:{
AppProfile: 'Wordpress'
}
properties: {
administratorLogin: administratorLogin
administratorLoginPassword: administratorLoginPassword
createMode: 'Default'
}
}
resource DatabaseMySQL 'Microsoft.DBforMySQL/servers/databases@2017-12-01' = {
name:DBName
parent:mySQLdb
properties:{
charset:charset
collation:collation
}
}
resource FirewallRules 'Microsoft.DBforMySQL/servers/firewallRules@2017-12-01' ={
name: 'AllowAll'
properties:{
startIpAddress: '0.0.0.0'
endIpAddress: '255.255.255.255'
}
parent:mySQLdb
}
resource hostnameBindingDefault 'Microsoft.Web/sites/hostNameBindings@2021-02-01' = {
parent: webApp
name: '${subDomain}.${Domain}'
properties: {
siteName: webAppName
azureResourceName: webAppName
azureResourceType: 'Website'
customHostNameDnsRecordType: 'CName'
hostNameType: 'Managed'
}
}
resource hostnameBindingAzureWebsites 'Microsoft.Web/sites/hostNameBindings@2021-02-01' = {
parent: webApp
name: '${webAppName}.azurewebsites.net'
properties: {
siteName:webAppName
hostNameType: 'Verified'
}
dependsOn:[
hostnameBindingDefault
]
}