forked from Azure-Samples/reactjs-webapp-functions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
postgres.bicep
65 lines (58 loc) · 1.58 KB
/
postgres.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
param location string
param name_prefix string
param workspace_id string
param administratorLogin string = 'postgres_admin'
@secure()
param administratorLoginPassword string
var server_name = '${name_prefix}-postgres-${uniqueString(resourceGroup().id)}'
resource server 'Microsoft.DBforPostgreSQL/servers@2017-12-01' = {
name: server_name
location: location
properties: {
createMode: 'Default'
administratorLogin: administratorLogin
administratorLoginPassword: administratorLoginPassword
sslEnforcement: 'Enabled'
}
}
resource database 'Microsoft.DBForPostgreSQL/servers/databases@2017-12-01' = {
name: '${server.name}/my_postgres'
}
resource firewall_rules 'Microsoft.DBForPostgreSQL/servers/firewallRules@2017-12-01' = {
name: '${server.name}/AllowAny'
properties: {
startIpAddress: '0.0.0.0'
endIpAddress: '255.255.255.255'
}
}
resource diagnostics 'microsoft.insights/diagnosticSettings@2017-05-01-preview' = {
scope: server
name: 'logAnalytics'
properties:{
workspaceId: workspace_id
logs:[
{
enabled: true
category: 'PostgreSQLLogs'
}
{
enabled: true
category: 'QueryStoreRuntimeStatistics'
}
{
enabled: true
category: 'QueryStoreWaitStatistics'
}
]
metrics:[
{
enabled: true
category: 'AllMetrics'
}
]
}
}
output pg_host string = server.properties.fullyQualifiedDomainName
output pg_user string = administratorLogin
output pg_password string = administratorLoginPassword
output pg_db string = last(split(database.name, '/'))