@@ -8,37 +8,56 @@ var webAppName = '${uniqueString(resourceGroup().id)}-${environment}'
8
8
var appServicePlanName = '${uniqueString (resourceGroup ().id )}-mpnp-asp'
9
9
var logAnalyticsName = '${uniqueString (resourceGroup ().id )}-mpnp-la'
10
10
var appInsightsName = '${uniqueString (resourceGroup ().id )}-mpnp-ai'
11
- var sku = 'S1 '
11
+ var sku = 'P0V3 '
12
12
var registryName = '${uniqueString (resourceGroup ().id )}mpnpreg'
13
13
var registrySku = 'Standard'
14
14
var imageName = 'techexcel/dotnetcoreapp'
15
15
var startupCommand = ''
16
+ var redisCacheName = '${uniqueString (resourceGroup ().id )}-mpnp-redis'
17
+ var redisCacheSku = 'Basic'
16
18
17
- // Create Log Analytics Workspace
18
- resource logAnalytics 'Microsoft.OperationalInsights/workspaces@2021-06-01' = {
19
+ resource redisCache 'Microsoft.Cache/Redis@2023-08-01' = {
20
+ name : redisCacheName
21
+ location : location
22
+ properties : {
23
+ sku : {
24
+ name : redisCacheSku
25
+ family : 'C'
26
+ capacity : 0
27
+ }
28
+ enableNonSslPort : false
29
+ minimumTlsVersion : '1.2'
30
+ redisConfiguration : {
31
+ 'maxmemory-policy' : 'volatile-lru'
32
+ }
33
+ }
34
+ }
35
+
36
+ resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2021-12-01-preview' = {
19
37
name : logAnalyticsName
20
38
location : location
21
39
properties : {
22
40
sku : {
23
41
name : 'PerGB2018'
24
42
}
25
- retentionInDays : 30
43
+ retentionInDays : 90
44
+ workspaceCapping : {
45
+ dailyQuotaGb : 1
46
+ }
26
47
}
27
48
}
28
49
29
- // Create Application Insights
30
- resource appInsights 'Microsoft.Insights/components@2020-02-02' = {
50
+ resource appInsights 'Microsoft.Insights/components@2020-02-02-preview' = {
31
51
name : appInsightsName
32
52
location : location
33
53
kind : 'web'
34
54
properties : {
35
55
Application_Type : 'web'
36
- WorkspaceResourceId : logAnalytics .id
56
+ WorkspaceResourceId : logAnalyticsWorkspace .id
37
57
}
38
58
}
39
59
40
- // Create Azure Container Registry
41
- resource containerRegistry 'Microsoft.ContainerRegistry/registries@2021-06-01-preview' = {
60
+ resource containerRegistry 'Microsoft.ContainerRegistry/registries@2020-11-01-preview' = {
42
61
name : registryName
43
62
location : location
44
63
sku : {
@@ -49,62 +68,56 @@ resource containerRegistry 'Microsoft.ContainerRegistry/registries@2021-06-01-pr
49
68
}
50
69
}
51
70
52
- // Create App Service Plan
53
- resource appServicePlan 'Microsoft.Web/serverfarms@2021-02-01' = {
71
+ resource appServicePlan 'Microsoft.Web/serverFarms@2022-09-01' = {
54
72
name : appServicePlanName
55
73
location : location
74
+ kind : 'linux'
75
+ properties : {
76
+ reserved : true
77
+ }
56
78
sku : {
57
79
name : sku
58
- tier : 'Standard'
59
- }
60
- properties : {
61
- reserved : true // This property is required for Linux
62
80
}
63
81
}
64
82
65
- // Create Web App
66
- resource webApp 'Microsoft.Web/sites@2021-02-01' = {
83
+ resource appServiceApp 'Microsoft.Web/sites@2020-12-01' = {
67
84
name : webAppName
68
85
location : location
69
86
properties : {
70
87
serverFarmId : appServicePlan .id
88
+ httpsOnly : true
89
+ clientAffinityEnabled : false
71
90
siteConfig : {
72
- linuxFxVersion : 'DOCKER|${imageName }'
91
+ linuxFxVersion : 'DOCKER|${containerRegistry .name }.azurecr.io/${uniqueString (resourceGroup ().id )}/${imageName }'
92
+ http20Enabled : true
93
+ minTlsVersion : '1.2'
94
+ appCommandLine : startupCommand
73
95
appSettings : [
96
+ {
97
+ name : 'WEBSITES_ENABLE_APP_SERVICE_STORAGE'
98
+ value : 'false'
99
+ }
74
100
{
75
101
name : 'DOCKER_REGISTRY_SERVER_URL'
76
- value : 'https://${registryName }.azurecr.io'
102
+ value : 'https://${containerRegistry . name }.azurecr.io'
77
103
}
78
104
{
79
105
name : 'DOCKER_REGISTRY_SERVER_USERNAME'
80
- value : containerRegistry .properties . adminUserEnabled ? listCredentials ( containerRegistry . id , '2021-06-01-preview' ). username : ''
106
+ value : containerRegistry .name
81
107
}
82
108
{
83
109
name : 'DOCKER_REGISTRY_SERVER_PASSWORD'
84
- value : containerRegistry .properties . adminUserEnabled ? listCredentials (containerRegistry . id , '2021-06-01-preview' ).passwords [0 ].value : ''
110
+ value : containerRegistry .listCredentials ().passwords [0 ].value
85
111
}
86
112
{
87
113
name : 'APPINSIGHTS_INSTRUMENTATIONKEY'
88
114
value : appInsights .properties .InstrumentationKey
89
115
}
90
- {
91
- name : 'APPLICATIONINSIGHTS_CONNECTION_STRING'
92
- value : appInsights .properties .ConnectionString
93
- }
94
- {
95
- name : 'WEBSITES_ENABLE_APP_SERVICE_STORAGE'
96
- value : 'false'
97
- }
98
- {
99
- name : 'WEBSITES_PORT'
100
- value : '80' // Default port for your application
101
- }
102
- ]
116
+ ]
117
+ }
103
118
}
104
- }
105
119
}
106
120
107
- // Outputs
108
- output appServiceName string = webApp .name
109
- output appServiceUrl string = 'https://${webAppName }.azurewebsites.net'
110
- output containerRegistryName string = containerRegistry .name
121
+ output application_name string = appServiceApp .name
122
+ output application_url string = appServiceApp .properties .hostNames [0 ]
123
+ output container_registry_name string = containerRegistry .name
0 commit comments