@@ -14,4 +14,97 @@ var registrySku = 'Standard'
14
14
var imageName = 'techexcel/dotnetcoreapp'
15
15
var startupCommand = ''
16
16
17
- // TODO: complete this script
17
+ // Create Log Analytics Workspace
18
+ resource logAnalytics 'Microsoft.OperationalInsights/workspaces@2021-06-01' = {
19
+ name : logAnalyticsName
20
+ location : location
21
+ properties : {
22
+ sku : {
23
+ name : 'PerGB2018'
24
+ }
25
+ retentionInDays : 30
26
+ }
27
+ }
28
+
29
+ // Create Application Insights
30
+ resource appInsights 'Microsoft.Insights/components@2020-02-02' = {
31
+ name : appInsightsName
32
+ location : location
33
+ kind : 'web'
34
+ properties : {
35
+ Application_Type : 'web'
36
+ WorkspaceResourceId : logAnalytics .id
37
+ }
38
+ }
39
+
40
+ // Create Azure Container Registry
41
+ resource containerRegistry 'Microsoft.ContainerRegistry/registries@2021-06-01-preview' = {
42
+ name : registryName
43
+ location : location
44
+ sku : {
45
+ name : registrySku
46
+ }
47
+ properties : {
48
+ adminUserEnabled : true
49
+ }
50
+ }
51
+
52
+ // Create App Service Plan
53
+ resource appServicePlan 'Microsoft.Web/serverfarms@2021-02-01' = {
54
+ name : appServicePlanName
55
+ location : location
56
+ sku : {
57
+ name : sku
58
+ tier : 'Standard'
59
+ }
60
+ properties : {
61
+ reserved : true // This property is required for Linux
62
+ }
63
+ }
64
+
65
+ // Create Web App
66
+ resource webApp 'Microsoft.Web/sites@2021-02-01' = {
67
+ name : webAppName
68
+ location : location
69
+ properties : {
70
+ serverFarmId : appServicePlan .id
71
+ siteConfig : {
72
+ linuxFxVersion : 'DOCKER|${imageName }'
73
+ appSettings : [
74
+ {
75
+ name : 'DOCKER_REGISTRY_SERVER_URL'
76
+ value : 'https://${registryName }.azurecr.io'
77
+ }
78
+ {
79
+ name : 'DOCKER_REGISTRY_SERVER_USERNAME'
80
+ value : containerRegistry .properties .adminUserEnabled ? listCredentials (containerRegistry .id , '2021-06-01-preview' ).username : ''
81
+ }
82
+ {
83
+ name : 'DOCKER_REGISTRY_SERVER_PASSWORD'
84
+ value : containerRegistry .properties .adminUserEnabled ? listCredentials (containerRegistry .id , '2021-06-01-preview' ).passwords [0 ].value : ''
85
+ }
86
+ {
87
+ name : 'APPINSIGHTS_INSTRUMENTATIONKEY'
88
+ value : appInsights .properties .InstrumentationKey
89
+ }
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
+ ]
103
+ }
104
+ }
105
+ }
106
+
107
+ // Outputs
108
+ output appServiceName string = webApp .name
109
+ output appServiceUrl string = 'https://${webAppName }.azurewebsites.net'
110
+ output containerRegistryName string = containerRegistry .name
0 commit comments