-
Notifications
You must be signed in to change notification settings - Fork 885
Expand file tree
/
Copy pathAzureAppServiceTests.AddAppServiceProjectWithApplicationInsightsSetsAppSettings.verified.bicep
More file actions
142 lines (127 loc) · 4.14 KB
/
AzureAppServiceTests.AddAppServiceProjectWithApplicationInsightsSetsAppSettings.verified.bicep
File metadata and controls
142 lines (127 loc) · 4.14 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
@description('The location for the resource(s) to be deployed.')
param location string = resourceGroup().location
param env_outputs_azure_container_registry_endpoint string
param env_outputs_planid string
param env_outputs_azure_container_registry_managed_identity_id string
param env_outputs_azure_container_registry_managed_identity_client_id string
param project1_containerimage string
param project1_containerport string
param env_outputs_azure_app_service_dashboard_uri string
param env_outputs_azure_website_contributor_managed_identity_id string
param env_outputs_azure_website_contributor_managed_identity_principal_id string
param env_outputs_azure_application_insights_instrumentationkey string
param env_outputs_azure_application_insights_connection_string string
resource mainContainer 'Microsoft.Web/sites/sitecontainers@2025-03-01' = {
name: 'main'
properties: {
authType: 'UserAssigned'
image: project1_containerimage
isMain: true
targetPort: project1_containerport
userManagedIdentityClientId: env_outputs_azure_container_registry_managed_identity_client_id
}
parent: webapp
}
resource webapp 'Microsoft.Web/sites@2025-03-01' = {
name: take('${toLower('project1')}-${uniqueString(resourceGroup().id)}', 60)
location: location
properties: {
serverFarmId: env_outputs_planid
siteConfig: {
numberOfWorkers: 30
linuxFxVersion: 'SITECONTAINERS'
acrUseManagedIdentityCreds: true
acrUserManagedIdentityID: env_outputs_azure_container_registry_managed_identity_client_id
appSettings: [
{
name: 'WEBSITES_PORT'
value: project1_containerport
}
{
name: 'OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES'
value: 'true'
}
{
name: 'OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES'
value: 'true'
}
{
name: 'OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY'
value: 'in_memory'
}
{
name: 'ASPNETCORE_FORWARDEDHEADERS_ENABLED'
value: 'true'
}
{
name: 'HTTP_PORTS'
value: project1_containerport
}
{
name: 'ASPIRE_ENVIRONMENT_NAME'
value: 'env'
}
{
name: 'OTEL_SERVICE_NAME'
value: 'project1'
}
{
name: 'OTEL_EXPORTER_OTLP_PROTOCOL'
value: 'grpc'
}
{
name: 'OTEL_EXPORTER_OTLP_ENDPOINT'
value: 'http://localhost:6001'
}
{
name: 'WEBSITE_ENABLE_ASPIRE_OTEL_SIDECAR'
value: 'true'
}
{
name: 'OTEL_COLLECTOR_URL'
value: env_outputs_azure_app_service_dashboard_uri
}
{
name: 'OTEL_CLIENT_ID'
value: env_outputs_azure_container_registry_managed_identity_client_id
}
{
name: 'APPINSIGHTS_INSTRUMENTATIONKEY'
value: env_outputs_azure_application_insights_instrumentationkey
}
{
name: 'APPLICATIONINSIGHTS_CONNECTION_STRING'
value: env_outputs_azure_application_insights_connection_string
}
{
name: 'ApplicationInsightsAgent_EXTENSION_VERSION'
value: '~3'
}
]
}
}
identity: {
type: 'UserAssigned'
userAssignedIdentities: {
'${env_outputs_azure_container_registry_managed_identity_id}': { }
}
}
}
resource project1_website_ra 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(webapp.id, env_outputs_azure_website_contributor_managed_identity_id, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'de139f84-1756-47ae-9be6-808fbbe84772'))
properties: {
principalId: env_outputs_azure_website_contributor_managed_identity_principal_id
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'de139f84-1756-47ae-9be6-808fbbe84772')
principalType: 'ServicePrincipal'
}
scope: webapp
}
resource slotConfigNames 'Microsoft.Web/sites/config@2025-03-01' = {
name: 'slotConfigNames'
properties: {
appSettingNames: [
'OTEL_SERVICE_NAME'
]
}
parent: webapp
}