@@ -14,4 +14,95 @@ var registrySku = 'Standard'
14
14
var imageName = 'techexcel/dotnetcoreapp'
15
15
var startupCommand = ''
16
16
17
- // TODO: complete this script
17
+ // Create a log analytics workspace
18
+ resource logAnalytics 'Microsoft.OperationalInsights/workspaces@2023-09-01' = {
19
+ name : logAnalyticsName
20
+ location : location
21
+ properties : {
22
+ sku : {
23
+ name : 'PerGB2018'
24
+ }
25
+ retentionInDays : 90
26
+ workspaceCapping : {
27
+ dailyQuotaGb : 2
28
+ }
29
+ }
30
+ }
31
+
32
+ //Create an application insights
33
+ resource appInsights 'Microsoft.Insights/components@2020-02-02' = {
34
+ name : appInsightsName
35
+ location : location
36
+ kind : 'web'
37
+ properties : {
38
+ Application_Type : 'web'
39
+ WorkspaceResourceId : logAnalytics .id
40
+ }
41
+ }
42
+
43
+ // Create a container registry
44
+ resource containerRegistry 'Microsoft.ContainerRegistry/registries@2023-01-01-preview' = {
45
+ name : registryName
46
+ location : location
47
+ sku : {
48
+ name : registrySku
49
+ }
50
+ properties : {
51
+ adminUserEnabled : true
52
+ }
53
+ }
54
+
55
+ // Create an app service plan
56
+ resource appServicePlan 'Microsoft.Web/serverfarms@2023-12-01' = {
57
+ name : appServicePlanName
58
+ location : location
59
+ kind : 'linux'
60
+ sku : {
61
+ name : sku
62
+ }
63
+ properties : {
64
+ reserved : true
65
+ }
66
+ }
67
+
68
+ // Create a web app
69
+ resource webApp 'Microsoft.Web/sites@2023-12-01' = {
70
+ name : webAppName
71
+ location : location
72
+ properties : {
73
+ serverFarmId : appServicePlan .id
74
+ httpsOnly : true
75
+ siteConfig : {
76
+ linuxFxVersion : 'DOCKER|${containerRegistry .name }.azurecr.io/${uniqueString (resourceGroup ().id )}/${imageName }'
77
+ http20Enabled : true
78
+ minTlsVersion : '1.2'
79
+ appCommandLine : startupCommand
80
+ appSettings : [
81
+ {
82
+ name : 'APPINSIGHTS_INSTRUMENTATIONKEY'
83
+ value : appInsights .properties .InstrumentationKey
84
+ }
85
+ {
86
+ name : 'DOCKER_REGISTRY_SERVER_URL'
87
+ value : 'https://${containerRegistry .name }.azurecr.io'
88
+ }
89
+ {
90
+ name : 'DOCKER_REGISTRY_SERVER_USERNAME'
91
+ value : containerRegistry .name
92
+ }
93
+ {
94
+ name : 'DOCKER_REGISTRY_SERVER_PASSWORD'
95
+ value : containerRegistry .listCredentials ().passwords [0 ].value
96
+ }
97
+ {
98
+ name : 'WEBSITES_ENABLE_APP_SERVICE_STORAGE'
99
+ value : 'false'
100
+ }
101
+ ]
102
+ }
103
+ }
104
+ }
105
+
106
+ output application_name string = webApp .name
107
+ output application_url string = webApp .properties .hostNames [0 ]
108
+ output container_registry_name string = containerRegistry .name
0 commit comments