@@ -14,6 +14,7 @@ param userName string
1414@description ('The username of the Azure SQL database server administrator for SQL authentication.' )
1515param sqlAdminUserName string
1616
17+ @secure ()
1718@description ('The password of the Azure SQL database server administrator for SQL authentication.' )
1819param sqlAdminPassword string
1920
@@ -29,9 +30,9 @@ param location string = resourceGroup().location
2930////////////////////////////////////////////
3031
3132// Create the server
32- var SQLServerName_var = '${projectName }server'
33- resource Server_Name_resource 'Microsoft.Sql/servers@2022-05 -01-preview' = {
34- name : SQLServerName_var
33+ var SQLServerName = '${projectName }server'
34+ resource Server_Name_resource 'Microsoft.Sql/servers@2023-02 -01-preview' = {
35+ name : SQLServerName
3536 location : location
3637 tags : {}
3738 identity : {
@@ -47,41 +48,43 @@ resource Server_Name_resource 'Microsoft.Sql/servers@2022-05-01-preview' = {
4748}
4849
4950// Allow Azure services and resources to access this server
50- resource Server_Name_AllowAllWindowsAzureIps 'Microsoft.Sql/servers/firewallRules@2022-05-01-preview' = {
51- name : '${Server_Name_resource .name }/AllowAllWindowsAzureIps'
51+ resource Server_Name_AllowAllWindowsAzureIps 'Microsoft.Sql/servers/firewallRules@2023-02-01-preview' = {
52+ parent : Server_Name_resource
53+ name : 'AllowAllWindowsAzureIps'
5254 properties : {
5355 endIpAddress : '0.0.0.0'
5456 startIpAddress : '0.0.0.0'
5557 }
5658}
5759
5860// Allow Client IP to access this server
59- resource Server_Name_AllowClientIP 'Microsoft.Sql/servers/firewallRules@2022-05-01-preview' = {
60- name : '${Server_Name_resource .name }/AllowClientIP'
61+ resource Server_Name_AllowClientIP 'Microsoft.Sql/servers/firewallRules@2023-02-01-preview' = {
62+ parent : Server_Name_resource
63+ name : 'AllowClientIP'
6164 properties : {
6265 endIpAddress : clientIP
6366 startIpAddress : clientIP
6467 }
6568}
6669
6770// Make the user an Azure AD administrator for the server, so that the user can connect with universal authentication
68- resource Server_Name_activeDirectory 'Microsoft.Sql/servers/administrators@2022-05-01-preview' = {
69- name : '${Server_Name_resource .name }/activeDirectory'
71+ resource Server_Name_activeDirectory 'Microsoft.Sql/servers/administrators@2023-02-01-preview' = {
72+ parent : Server_Name_resource
73+ name : 'activeDirectory'
7074 properties : {
7175 administratorType : 'ActiveDirectory'
7276 login : userName
73- //sid: reference(resourceId('Microsoft.Sql/servers', '${projectName}server'), '2019-06-01-preview', 'Full').identity.principalId
7477 sid : userObjectId
75- //tenantId: AAD_TenantId //optional
76- }
78+ }
7779}
7880
7981//////////////////////////////////////////////////////////////////////////////
8082// Create the ContosoHR database using the DC-series hardware configuration //
8183//////////////////////////////////////////////////////////////////////////////
8284
83- resource Database_Resource 'Microsoft.Sql/servers/databases@2022-05-01-preview' = {
84- name : '${Server_Name_resource .name }/ContosoHR'
85+ resource Database_Resource 'Microsoft.Sql/servers/databases@2023-02-01-preview' = {
86+ parent : Server_Name_resource
87+ name : 'ContosoHR'
8588 location : location
8689 tags : {}
8790 sku : {
@@ -96,18 +99,18 @@ resource Database_Resource 'Microsoft.Sql/servers/databases@2022-05-01-preview'
9699///////////////////////////////////////
97100
98101// Create the attestation provider
99- resource attestationProviderName_resource 'Microsoft.Attestation/attestationProviders@2021-06-01-preview ' = {
100- name : '${projectName }attest '
102+ resource attestationProviderName 'Microsoft.Attestation/attestationProviders@2021-06-01' = {
103+ name : '${projectName }attestation '
101104 location : location
102105 properties : {}
103106}
104107
105108///////////////////////////////////
106109// Configure the web application //
107110///////////////////////////////////
108-
111+ var sqlServerSuffix = environment (). suffixes . sqlServerHostname
109112// Create an App Service plan
110- resource WebAppServicePlan_Resource 'Microsoft.Web/serverfarms@2022-03 -01' = {
113+ resource WebAppServicePlan_Resource 'Microsoft.Web/serverfarms@2022-09 -01' = {
111114 name : '${projectName }plan'
112115 location : location
113116 properties : {}
@@ -117,7 +120,7 @@ resource WebAppServicePlan_Resource 'Microsoft.Web/serverfarms@2022-03-01' = {
117120}
118121
119122// Create the App Service
120- resource WebApp_Resource 'Microsoft.Web/sites@2022-03 -01' = {
123+ resource WebApp_Resource 'Microsoft.Web/sites@2022-09 -01' = {
121124 name : '${projectName }app'
122125 location : location
123126 identity : {
@@ -132,7 +135,7 @@ resource WebApp_Resource 'Microsoft.Web/sites@2022-03-01' = {
132135 name : 'connectionstrings'
133136 properties : {
134137 ContosoHRDatabase : {
135- value : 'Server=tcp:${Server_Name_resource .name }.database.windows.net ;Database=ContosoHR;Column Encryption Setting=Enabled; Attestation Protocol = AAS; Enclave Attestation Url=${attestationProviderName_resource .properties .attestUri }; Authentication=Active Directory Managed Identity'
138+ value : 'Server=tcp:${Server_Name_resource .name }${ sqlServerSuffix } ;Database=ContosoHR;Column Encryption Setting=Enabled; Attestation Protocol = AAS; Enclave Attestation Url=${attestationProviderName .properties .attestUri }; Authentication=Active Directory Managed Identity'
136139 type : 'SQLAzure'
137140 }
138141 }
@@ -147,8 +150,9 @@ resource WebApp_Resource 'Microsoft.Web/sites@2022-03-01' = {
147150}
148151
149152 // Deploy the application
150- resource sourceControl 'Microsoft.Web/sites/sourcecontrols@2022-03-01' = {
151- name : '${projectName }app/web'
153+ resource sourceControl 'Microsoft.Web/sites/sourcecontrols@2022-09-01' = {
154+ parent : WebApp_Resource
155+ name : 'web'
152156 properties : {
153157 repoUrl : 'https://github.com/microsoft/sql-server-samples.git'
154158 branch : 'master'
@@ -164,7 +168,7 @@ resource sourceControl 'Microsoft.Web/sites/sourcecontrols@2022-03-01' = {
164168//////////////////////////////////////
165169
166170// Create a key vault and assign key permissions to the user, so that the user can manage the keys
167- resource KeyVault_Resource 'Microsoft.KeyVault/vaults@2022-07 -01' = {
171+ resource KeyVault_Resource 'Microsoft.KeyVault/vaults@2023-02 -01' = {
168172 name : '${projectName }vault'
169173 location : location
170174 tags : {}
@@ -197,7 +201,7 @@ resource KeyVault_Resource 'Microsoft.KeyVault/vaults@2022-07-01' = {
197201}
198202
199203// Assign key permissions to the web app
200- resource KeyVaultWebAppAccessPolicy_Resource 'Microsoft.KeyVault/vaults/accessPolicies@2022-07 -01' = {
204+ resource KeyVaultWebAppAccessPolicy_Resource 'Microsoft.KeyVault/vaults/accessPolicies@2023-02 -01' = {
201205 name : any ('${KeyVault_Resource .name }/add' )
202206 properties : {
203207 accessPolicies : [
@@ -218,8 +222,9 @@ resource KeyVaultWebAppAccessPolicy_Resource 'Microsoft.KeyVault/vaults/accessPo
218222}
219223
220224// Create a key
221- resource Key_Resource 'Microsoft.KeyVault/vaults/keys@2022-07-01' = {
222- name : '${KeyVault_Resource .name }/CMK'
225+ resource Key_Resource 'Microsoft.KeyVault/vaults/keys@2023-02-01' = {
226+ parent : KeyVault_Resource
227+ name : 'CMK'
223228 tags : {}
224229 properties : {
225230 attributes : {
0 commit comments