Skip to content

Commit 0e8e718

Browse files
committed
Made changes to use connection string instead of Instrumentation key for App insights logging
1 parent 223c8b4 commit 0e8e718

File tree

12 files changed

+22
-29
lines changed

12 files changed

+22
-29
lines changed

samples/Quickstart/infra/apiManagement/apim.bicep

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ param sku string
44
param skuCount int
55
param publisherName string
66
param publisherEmail string
7-
param appInsightsInstrumentationKey string
7+
param appInsightsConnectionString string
88
param useAPIM bool
99
param appInsightsName string
1010
param appInsightsExternalId string = '/subscriptions/${subscription().subscriptionId}/resourceGroups/${resourceGroup().name}/providers/microsoft.insights/components/${appInsightsName}'
@@ -30,8 +30,7 @@ resource apim 'Microsoft.ApiManagement/service@2021-12-01-preview' = if (useAPIM
3030
properties: {
3131
loggerType: 'applicationInsights'
3232
credentials: {
33-
appInsightsInstrumentationKey: appInsightsInstrumentationKey
34-
instrumentationKey: appInsightsInstrumentationKey
33+
connectionString: appInsightsConnectionString
3534
}
3635
isBuffered: true
3736
resourceId: appInsightsExternalId

samples/Quickstart/infra/azureFunction.bicep

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
param storageAccountName string
22
param appServiceName string
33
param functionAppName string
4-
param appInsightsInstrumentationKey string
4+
param appInsightsConnectionString string
55
param location string
66
param functionSettings object = {}
77
param appTags object = {}
@@ -91,8 +91,7 @@ resource functionAppSettings 'Microsoft.Web/sites/config@2022-09-01' = {
9191
AzureWebJobsStorage__accountname: storageAccountName
9292
FUNCTIONS_EXTENSION_VERSION: '~4'
9393
FUNCTIONS_WORKER_RUNTIME: 'dotnet-isolated'
94-
APPINSIGHTS_INSTRUMENTATIONKEY: appInsightsInstrumentationKey
95-
APPLICATIONINSIGHTS_CONNECTION_STRING: 'InstrumentationKey=${appInsightsInstrumentationKey}'
94+
APPLICATIONINSIGHTS_CONNECTION_STRING: appInsightsConnectionString
9695
SCM_DO_BUILD_DURING_DEPLOYMENT: 'false'
9796
ENABLE_ORYX_BUILD: 'false'
9897
}, functionSettings)

samples/Quickstart/infra/core.bicep

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ module function './azureFunction.bicep'= {
109109
functionAppName: functionAppName
110110
storageAccountName: funcStorName
111111
location: location
112-
appInsightsInstrumentationKey: monitoring.outputs.appInsightsInstrumentationKey
112+
appInsightsConnectionString: monitoring.outputs.appInsightsInstrumentationString
113113
functionSettings: union({
114114
AZURE_FhirServerUrl: 'https://${workspaceName}-${fhirServiceName}.fhir.azurehealthcareapis.com'
115-
AZURE_InstrumentationKey: monitoring.outputs.appInsightsInstrumentationString
115+
AZURE_AppInsightsConnectionString: monitoring.outputs.appInsightsInstrumentationString
116116
}, functionAppCustomSettings)
117117
appTags: appTags
118118
}
@@ -150,7 +150,7 @@ module apimService './apiManagement/apim.bicep' = if (useAPIM) {
150150
skuCount: skuCount
151151
publisherName: publisherName
152152
publisherEmail: publisherEmail
153-
appInsightsInstrumentationKey: monitoring.outputs.appInsightsInstrumentationKey
153+
appInsightsConnectionString: monitoring.outputs.appInsightsInstrumentationString
154154
useAPIM:useAPIM
155155
appInsightsName:appInsightsName
156156
}

samples/Quickstart/infra/monitoring.bicep

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,4 @@ resource appInsights 'Microsoft.Insights/components@2020-02-02-preview' = {
5050
}
5151
tags: appTags
5252
}
53-
54-
output appInsightsInstrumentationKey string = appInsights.properties.InstrumentationKey
5553
output appInsightsInstrumentationString string= appInsights.properties.ConnectionString

samples/Quickstart/src/Configuration/MyServiceConfig.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ public class MyServiceConfig
44
{
55
public Uri FhirServerUrl { get; set; }
66

7-
public string InstrumentationKey { get; set; }
7+
public string AppInsightsConnectionString { get; set; }
88
}
99
}

samples/Quickstart/src/Program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ private static async Task Main(string[] args)
3636
.ConfigureFunctionsWorkerDefaults()
3737
.ConfigureServices(services =>
3838
{
39-
if (config.InstrumentationKey != null)
39+
if (config.AppInsightsConnectionString != null)
4040
{
41-
services.UseAppInsightsLogging(config.InstrumentationKey, LogLevel.Information);
42-
services.UseTelemetry(config.InstrumentationKey);
41+
services.UseAppInsightsLogging(config.AppInsightsConnectionString, LogLevel.Information);
42+
services.UseTelemetry(config.AppInsightsConnectionString);
4343
}
4444

4545
// Setup custom headers for use in an Input Filter

samples/UseCaseSamples/ModifyCapabilityStatement/infra/apiManagement/apim.bicep

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ param sku string
44
param skuCount int
55
param publisherName string
66
param publisherEmail string
7-
param appInsightsInstrumentationKey string
7+
param appInsightsConnectionString string
88
param useAPIM bool
99
param appInsightsName string
1010
param appInsightsExternalId string = '/subscriptions/${subscription().subscriptionId}/resourceGroups/${resourceGroup().name}/providers/microsoft.insights/components/${appInsightsName}'
@@ -30,8 +30,7 @@ resource apim 'Microsoft.ApiManagement/service@2021-12-01-preview' = if (useAPIM
3030
properties: {
3131
loggerType: 'applicationInsights'
3232
credentials: {
33-
appInsightsInstrumentationKey: appInsightsInstrumentationKey
34-
instrumentationKey: appInsightsInstrumentationKey
33+
connectionString: appInsightsConnectionString
3534
}
3635
isBuffered: true
3736
resourceId: appInsightsExternalId

samples/UseCaseSamples/ModifyCapabilityStatement/infra/azureFunction.bicep

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
param storageAccountName string
22
param appServiceName string
33
param functionAppName string
4-
param appInsightsInstrumentationKey string
4+
param appInsightsConnectionString string
55
param location string
66
param functionSettings object = {}
77
param appTags object = {}
@@ -90,8 +90,7 @@ resource functionAppSettings 'Microsoft.Web/sites/config@2022-09-01' = {
9090
AzureWebJobsStorage__accountname: storageAccountName
9191
FUNCTIONS_EXTENSION_VERSION: '~4'
9292
FUNCTIONS_WORKER_RUNTIME: 'dotnet-isolated'
93-
APPINSIGHTS_INSTRUMENTATIONKEY: appInsightsInstrumentationKey
94-
APPLICATIONINSIGHTS_CONNECTION_STRING: 'InstrumentationKey=${appInsightsInstrumentationKey}'
93+
APPLICATIONINSIGHTS_CONNECTION_STRING: appInsightsConnectionString
9594
SCM_DO_BUILD_DURING_DEPLOYMENT: 'false'
9695
ENABLE_ORYX_BUILD: 'false'
9796
}, functionSettings)

samples/UseCaseSamples/ModifyCapabilityStatement/infra/core.bicep

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ module function './azureFunction.bicep'= {
9595
functionAppName: functionAppName
9696
storageAccountName: funcStorName
9797
location: location
98-
appInsightsInstrumentationKey: monitoring.outputs.appInsightsInstrumentationKey
98+
appInsightsConnectionString: monitoring.outputs.appInsightsInstrumentationString
9999
functionSettings: union({
100100
AZURE_FhirServerUrl: 'https://${workspaceName}-${fhirServiceName}.fhir.azurehealthcareapis.com'
101-
AZURE_InstrumentationKey: monitoring.outputs.appInsightsInstrumentationString
101+
AZURE_AppInsightsConnectionString: monitoring.outputs.appInsightsInstrumentationString
102102
}, functionAppCustomSettings)
103103
appTags: appTags
104104
}
@@ -136,7 +136,7 @@ module apimService './apiManagement/apim.bicep' = if (useAPIM) {
136136
skuCount: skuCount
137137
publisherName: publisherName
138138
publisherEmail: publisherEmail
139-
appInsightsInstrumentationKey: monitoring.outputs.appInsightsInstrumentationKey
139+
appInsightsConnectionString: monitoring.outputs.appInsightsInstrumentationString
140140
useAPIM:useAPIM
141141
appInsightsName:appInsightsName
142142
}

samples/UseCaseSamples/ModifyCapabilityStatement/infra/monitoring.bicep

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,4 @@ resource appInsights 'Microsoft.Insights/components@2020-02-02-preview' = {
5151
tags: appTags
5252
}
5353

54-
output appInsightsInstrumentationKey string = appInsights.properties.InstrumentationKey
5554
output appInsightsInstrumentationString string= appInsights.properties.ConnectionString

0 commit comments

Comments
 (0)