diff --git a/.github/workflows/e2e-ci.yaml b/.github/workflows/e2e-ci.yaml
index 7e8d6232a0..528e5824ff 100644
--- a/.github/workflows/e2e-ci.yaml
+++ b/.github/workflows/e2e-ci.yaml
@@ -353,7 +353,7 @@ jobs:
IOT_HUB_RESOURCE_ID: ${{ secrets.IOT_HUB_RESOURCE_ID }}
LOG_ANALYTICS_WORKSPACE_ID: ${{ secrets.LOG_ANALYTICS_WORKSPACE_ID }}
LOG_ANALYTICS_SHARED_KEY: ${{ secrets.LOG_ANALYTICS_SHARED_KEY }}
- APPINSIGHTS_INSTRUMENTATIONKEY: ${{ secrets.APPINSIGHTS_INSTRUMENTATIONKEY }}
+ APPLICATIONINSIGHTS_CONNECTION_STRING: ${{ secrets.APPLICATIONINSIGHTS_CONNECTION_STRING }}
CERT_REMOTE_PATH: ${{ needs.env_var.outputs.CertRemotePath }}
SERVER_PFX_PASSWORD: ${{ secrets.SERVER_PFX_PASSWORD }}
NET_SRV_LOG_TO_TCP_ADDRESS: "itestup"
@@ -385,7 +385,7 @@ jobs:
IOT_HUB_RESOURCE_ID: ${{ secrets.IOT_HUB_RESOURCE_ID }}
LOG_ANALYTICS_WORKSPACE_ID: ${{ secrets.LOG_ANALYTICS_WORKSPACE_ID }}
LOG_ANALYTICS_SHARED_KEY: ${{ secrets.LOG_ANALYTICS_SHARED_KEY }}
- APPINSIGHTS_INSTRUMENTATIONKEY: ${{ secrets.APPINSIGHTS_INSTRUMENTATIONKEY }}
+ APPLICATIONINSIGHTS_CONNECTION_STRING: ${{ secrets.APPLICATIONINSIGHTS_CONNECTION_STRING }}
steps:
- uses: actions/checkout@v3
name: Checkout current branch
@@ -436,7 +436,7 @@ jobs:
IOT_HUB_RESOURCE_ID: ${{ secrets.IOT_HUB_RESOURCE_ID }}
LOG_ANALYTICS_WORKSPACE_ID: ${{ secrets.LOG_ANALYTICS_WORKSPACE_ID }}
LOG_ANALYTICS_SHARED_KEY: ${{ secrets.LOG_ANALYTICS_SHARED_KEY }}
- APPINSIGHTS_INSTRUMENTATIONKEY: ${{ secrets.APPINSIGHTS_INSTRUMENTATIONKEY }}
+ APPLICATIONINSIGHTS_CONNECTION_STRING: ${{ secrets.APPLICATIONINSIGHTS_CONNECTION_STRING }}
with:
deployment_file_name: '${{ secrets.DEPLOYMENT_FILE_NAME }}'
architecture: '${{ secrets.ARCHITECTURE }}'
diff --git a/Directory.Build.props b/Directory.Build.props
index deeba211a6..6872769c41 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -24,7 +24,7 @@
4.3.0
2.6.48
4.7.0
- 2.20.0
+ 2.21.0
6.0.0
1.6.1
2.2.0
diff --git a/LoRaEngine/deployment.ci.aio.template.json b/LoRaEngine/deployment.ci.aio.template.json
index 37c8f78f87..793ade45c5 100644
--- a/LoRaEngine/deployment.ci.aio.template.json
+++ b/LoRaEngine/deployment.ci.aio.template.json
@@ -113,8 +113,8 @@
"LOG_TO_TCP_ADDRESS": {
"value": "$NET_SRV_LOG_TO_TCP_ADDRESS"
},
- "APPINSIGHTS_INSTRUMENTATIONKEY": {
- "value": "$APPINSIGHTS_INSTRUMENTATIONKEY"
+ "APPLICATIONINSIGHTS_CONNECTION_STRING": {
+ "value": "$APPLICATIONINSIGHTS_CONNECTION_STRING"
},
"LNS_SERVER_PFX_PATH": {
"value": "/var/lorastarterkit/certs/server.pfx"
diff --git a/LoRaEngine/deployment.ci.lns.eflow.template.json b/LoRaEngine/deployment.ci.lns.eflow.template.json
index 26f2e81499..4a8da3d966 100644
--- a/LoRaEngine/deployment.ci.lns.eflow.template.json
+++ b/LoRaEngine/deployment.ci.lns.eflow.template.json
@@ -104,8 +104,8 @@
"LOG_TO_TCP_ADDRESS": {
"value": "$NET_SRV_LOG_TO_TCP_ADDRESS"
},
- "APPINSIGHTS_INSTRUMENTATIONKEY": {
- "value": "$APPINSIGHTS_INSTRUMENTATIONKEY"
+ "APPLICATIONINSIGHTS_CONNECTION_STRING": {
+ "value": "$APPLICATIONINSIGHTS_CONNECTION_STRING"
},
"LNS_VERSION": {
"value": "$NET_SRV_VERSION"
diff --git a/LoRaEngine/deployment.template.json b/LoRaEngine/deployment.template.json
index e1bd14f595..88e7d0f376 100644
--- a/LoRaEngine/deployment.template.json
+++ b/LoRaEngine/deployment.template.json
@@ -102,8 +102,8 @@
"LOG_TO_TCP_ADDRESS": {
"value": "$NET_SRV_LOG_TO_TCP_ADDRESS"
},
- "APPINSIGHTS_INSTRUMENTATIONKEY": {
- "value": "$APPINSIGHTS_INSTRUMENTATIONKEY"
+ "APPLICATIONINSIGHTS_CONNECTION_STRING": {
+ "value": "$APPLICATIONINSIGHTS_CONNECTION_STRING"
}
},
"status": "running",
diff --git a/LoRaEngine/example.env b/LoRaEngine/example.env
index d5a4d6cc90..5d3a3152dc 100644
--- a/LoRaEngine/example.env
+++ b/LoRaEngine/example.env
@@ -47,7 +47,7 @@ LBS_SPI_DEV=0
##############################
# Azure Monitor settings
##############################
-APPINSIGHTS_INSTRUMENTATIONKEY=""
+APPLICATIONINSIGHTS_CONNECTION_STRING=""
IOT_HUB_RESOURCE_ID=""
LOG_ANALYTICS_WORKSPACE_ID=""
LOG_ANALYTICS_SHARED_KEY=""
diff --git a/LoRaEngine/modules/LoRaWanNetworkSrvModule/LoRaWan.NetworkServer/BasicsStation/BasicsStationNetworkServerStartup.cs b/LoRaEngine/modules/LoRaWanNetworkSrvModule/LoRaWan.NetworkServer/BasicsStation/BasicsStationNetworkServerStartup.cs
index 776f3c11aa..5817bdc2eb 100644
--- a/LoRaEngine/modules/LoRaWanNetworkSrvModule/LoRaWan.NetworkServer/BasicsStation/BasicsStationNetworkServerStartup.cs
+++ b/LoRaEngine/modules/LoRaWanNetworkSrvModule/LoRaWan.NetworkServer/BasicsStation/BasicsStationNetworkServerStartup.cs
@@ -19,6 +19,7 @@ namespace LoRaWan.NetworkServer.BasicsStation
using LoRaWan.NetworkServer.BasicsStation.ModuleConnection;
using LoRaWan.NetworkServer.BasicsStation.Processors;
using Microsoft.ApplicationInsights;
+ using Microsoft.ApplicationInsights.AspNetCore.Extensions;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
@@ -49,8 +50,8 @@ public void ConfigureServices(IServiceCollection services)
ITransportSettings[] settings = { new AmqpTransportSettings(TransportType.Amqp_Tcp_Only) };
var loraModuleFactory = new LoRaModuleClientFactory(settings);
- var appInsightsKey = Configuration.GetValue("APPINSIGHTS_INSTRUMENTATIONKEY");
- var useApplicationInsights = !string.IsNullOrEmpty(appInsightsKey);
+ var appInsightsConnectionString = Configuration.GetValue("APPLICATIONINSIGHTS_CONNECTION_STRING");
+ var useApplicationInsights = !string.IsNullOrEmpty(appInsightsConnectionString);
_ = services.AddLogging(loggingBuilder =>
{
_ = loggingBuilder.ClearProviders();
@@ -72,7 +73,8 @@ public void ConfigureServices(IServiceCollection services)
if (useApplicationInsights)
{
- _ = loggingBuilder.AddApplicationInsights(appInsightsKey)
+ _ = loggingBuilder.AddApplicationInsights(telemetryConfiguration => { telemetryConfiguration.ConnectionString = appInsightsConnectionString; },
+ loggerOptions => { })
.AddFilter(string.Empty, logLevel);
_ = services.AddSingleton(_ => new TelemetryInitializer(NetworkServerConfiguration));
}
@@ -116,7 +118,7 @@ public void ConfigureServices(IServiceCollection services)
if (useApplicationInsights)
{
- _ = services.AddApplicationInsightsTelemetry(appInsightsKey)
+ _ = services.AddApplicationInsightsTelemetry(new ApplicationInsightsServiceOptions { ConnectionString = appInsightsConnectionString })
.AddSingleton();
}
else
diff --git a/Template/azuredeploy.json b/Template/azuredeploy.json
index 3530d8db17..68e4d101da 100644
--- a/Template/azuredeploy.json
+++ b/Template/azuredeploy.json
@@ -222,8 +222,8 @@
"value": "[concat('https://raw.githubusercontent.com/',variables('gitUsername'),'/iotedge-lorawan-starterkit/',variables('gitBranch'),'/Template/deviceConfiguration.json')]"
},
{
- "name": "APPINSIGHTS_INSTRUMENTATIONKEY",
- "value": "[reference(concat('microsoft.insights/components/', variables('appInsightName'))).InstrumentationKey]"
+ "name": "APPLICATIONINSIGHTS_CONNECTION_STRING",
+ "value": "[reference(concat('microsoft.insights/components/', variables('appInsightName'))).ConnectionString]"
},
{
"name": "WEBSITE_RUN_FROM_PACKAGE",
@@ -414,8 +414,8 @@
"discoveryZipUrl": {
"value": "[variables('discoveryServiceZipBinary')]"
},
- "appInsightsInstrumentationKey": {
- "value": "[reference(concat('microsoft.insights/components/', variables('appInsightName'))).InstrumentationKey]"
+ "applicationInsightsConnectionString": {
+ "value": "[reference(concat('microsoft.insights/components/', variables('appInsightName'))).ConnectionString]"
}
}
}
diff --git a/Template/discoveryService.json b/Template/discoveryService.json
index 00ac1e101b..2c0683b49e 100644
--- a/Template/discoveryService.json
+++ b/Template/discoveryService.json
@@ -26,7 +26,7 @@
"iotHubName": {
"type": "string"
},
- "appInsightsInstrumentationKey": {
+ "applicationInsightsConnectionString": {
"type": "string"
},
"roleNameGuid": {
@@ -81,8 +81,8 @@
"value": "[variables('aspNetCoreUrls')]"
},
{
- "name": "APPINSIGHTS_INSTRUMENTATIONKEY",
- "value": "[parameters('appInsightsInstrumentationKey')]"
+ "name": "APPLICATIONINSIGHTS_CONNECTION_STRING",
+ "value": "[parameters('applicationInsightsConnectionString')]"
}
],
"webSocketsEnabled": true
diff --git a/Tests/Unit/NetworkServer/ApplicationInsightsTracingTests.cs b/Tests/Unit/NetworkServer/ApplicationInsightsTracingTests.cs
index a62235589d..7423014fa0 100644
--- a/Tests/Unit/NetworkServer/ApplicationInsightsTracingTests.cs
+++ b/Tests/Unit/NetworkServer/ApplicationInsightsTracingTests.cs
@@ -26,7 +26,7 @@ public ApplicationInsightsTracingTests()
this.configuration = new TelemetryConfiguration
{
TelemetryChannel = this.stubTelemetryChannel,
- InstrumentationKey = Guid.NewGuid().ToString(),
+ ConnectionString = $"InstrumentationKey={Guid.NewGuid()};IngestionEndpoint=https://westeurope-2.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/",
TelemetryInitializers = { new OperationCorrelationTelemetryInitializer() }
};
}