forked from LanguageResources/Homework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSQL.bicep
More file actions
92 lines (74 loc) · 2.34 KB
/
SQL.bicep
File metadata and controls
92 lines (74 loc) · 2.34 KB
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
@description('The sqladmin password of the SQL logical server.')
@secure()
param pSQLPassword string
@description('The sqladmin password of the SQL logical server.')
param pSQLServer object
@description('The AD related object to be integrated.')
param pActiveDirectory object
@description('Az SQL Server lock if required.')
param pLock object
@description('change tags if required.')
param pTag object
@description('Location for sql resources.')
param pLocation string = resourceGroup().location
var vTag = (empty(pTag) ? json('null') : pTag)
resource sqlServer 'Microsoft.Sql/servers@2022-02-01-preview' = {
name: pSQLServer.Name
location: pLocation
tags: vTag
identity: {
type: 'SystemAssigned'
}
properties: {
administratorLogin: pSQLServer.Username
administratorLoginPassword: pSQLPassword
version: pSQLServer.Version
minimalTlsVersion: pSQLServer.MinimalTLSVersion
publicNetworkAccess: pSQLServer.PublicNetworkAccess
}
}
resource sqlDBMaster 'Microsoft.Sql/servers/databases@2022-02-01-preview' = {
parent: sqlServer
name: 'master'
location: pLocation
properties: {
}
}
resource ResourceLock 'Microsoft.Authorization/locks@2020-05-01' = if (pLock.Deploy) {
scope: sqlServer
name: 'sqlServerLock'
properties: {
level: pLock.Type
notes: pLock.Notes
}
}
resource connectionPolicies 'Microsoft.Sql/servers/connectionPolicies@2022-02-01-preview' = {
parent: sqlServer
name: 'default'
properties: {
connectionType: pSQLServer.ConnectionType
}
}
resource administrators_activeDirectory 'Microsoft.Sql/servers/administrators@2022-02-01-preview' = if (pActiveDirectory.Deploy) {
parent: sqlServer
name: 'ActiveDirectory'
properties: {
administratorType: 'ActiveDirectory'
login: pActiveDirectory.AdminGroup
sid: pActiveDirectory.AdminGroupSID
}
dependsOn: [
connectionPolicies
]
}
resource azureADOnlyAuthentications 'Microsoft.Sql/servers/azureADOnlyAuthentications@2022-02-01-preview' = if (pActiveDirectory.AADOnlyAuthentication && (!empty(pActiveDirectory.AdminGroup))) {
parent: sqlServer
name: 'default'
properties: {
azureADOnlyAuthentication: pActiveDirectory.AADOnlyAuthentication
}
dependsOn: [
connectionPolicies
administrators_activeDirectory
]
}