From d7140332bbff847d4b265360c0cd52515b8ac74e Mon Sep 17 00:00:00 2001 From: Harmanpreet Kaur Date: Thu, 22 Jan 2026 10:47:44 +0530 Subject: [PATCH 1/5] fix: disable Azure SDK auto-instrumentation to prevent response format errors --- src/backend/api/api_routes.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/backend/api/api_routes.py b/src/backend/api/api_routes.py index 8a3be72f..296d4fd4 100644 --- a/src/backend/api/api_routes.py +++ b/src/backend/api/api_routes.py @@ -43,9 +43,14 @@ instrumentation_key = os.getenv("APPLICATIONINSIGHTS_CONNECTION_STRING") if instrumentation_key: # Configure Application Insights if the Instrumentation Key is found - configure_azure_monitor(connection_string=instrumentation_key) + configure_azure_monitor( + connection_string=instrumentation_key, + instrumentation_options={ + "azure_sdk": {"enabled": False}, # Don't modify Azure SDK HTTP responses + } + ) logging.info( - "Application Insights configured with the provided Instrumentation Key" + "Application Insights configured with Azure SDK instrumentation disabled" ) else: # Log a warning if the Instrumentation Key is not found From 87653f0f5e841644f8e55858b2e993b586437894 Mon Sep 17 00:00:00 2001 From: Harmanpreet-Microsoft Date: Tue, 27 Jan 2026 18:12:44 +0530 Subject: [PATCH 2/5] Update logging message for Application Insights configuration --- src/backend/api/api_routes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/api/api_routes.py b/src/backend/api/api_routes.py index 296d4fd4..1350c04f 100644 --- a/src/backend/api/api_routes.py +++ b/src/backend/api/api_routes.py @@ -46,11 +46,11 @@ configure_azure_monitor( connection_string=instrumentation_key, instrumentation_options={ - "azure_sdk": {"enabled": False}, # Don't modify Azure SDK HTTP responses + "azure_sdk": {"enabled": False}, } ) logging.info( - "Application Insights configured with Azure SDK instrumentation disabled" + "Application Insights configured with the provided Instrumentation Key" ) else: # Log a warning if the Instrumentation Key is not found From 2f5ca1320185cc9880dec9ae2c356e4f4fd284bd Mon Sep 17 00:00:00 2001 From: Harmanpreet-Microsoft Date: Wed, 25 Feb 2026 21:55:54 +0530 Subject: [PATCH 3/5] fix: enable public network access and local authentication for WAF configuration --- infra/main.bicep | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/infra/main.bicep b/infra/main.bicep index 34d5b1fc..01a26f05 100644 --- a/infra/main.bicep +++ b/infra/main.bicep @@ -230,8 +230,8 @@ module logAnalyticsWorkspace 'br/public:avm/res/operational-insights/workspace:0 } : null // WAF aligned configuration for Private Networking - publicNetworkAccessForIngestion: enablePrivateNetworking ? 'Disabled' : 'Enabled' - publicNetworkAccessForQuery: enablePrivateNetworking ? 'Disabled' : 'Enabled' + publicNetworkAccessForIngestion: 'Enabled' + publicNetworkAccessForQuery: 'Enabled' dataSources: enablePrivateNetworking ? [ { @@ -287,7 +287,7 @@ module applicationInsights 'br/public:avm/res/insights/component:0.7.0' = if (en retentionInDays: 365 kind: 'web' disableIpMasking: false - disableLocalAuth: true + disableLocalAuth: false flowType: 'Bluefield' } } From 0088b6afd184e6a5a3777faf9f60d5bb116fa3f2 Mon Sep 17 00:00:00 2001 From: Harmanpreet-Microsoft Date: Thu, 26 Feb 2026 11:31:50 +0530 Subject: [PATCH 4/5] fix: uncomment Azure Monitor OpenTelemetry integration in API routes --- src/backend/api/api_routes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/api/api_routes.py b/src/backend/api/api_routes.py index 79ca4bb2..8d0dbdc5 100644 --- a/src/backend/api/api_routes.py +++ b/src/backend/api/api_routes.py @@ -15,7 +15,7 @@ # Third-party # Azure Monitor OpenTelemetry integration is currently causing issues with OpenAI calls in process_batch_async, needs further investigation, commenting out for now -# from azure.monitor.opentelemetry import configure_azure_monitor +from azure.monitor.opentelemetry import configure_azure_monitor from common.logger.app_logger import AppLogger from common.services.batch_service import BatchService @@ -47,7 +47,7 @@ configure_azure_monitor( connection_string=instrumentation_key, instrumentation_options={ - "azure_sdk": {"enabled": False}, + "azure_sdk": {"enabled": False}, } ) logging.info( From 540c1f3a644bdb9561d25539781628c67247bea3 Mon Sep 17 00:00:00 2001 From: Harmanpreet-Microsoft Date: Thu, 26 Feb 2026 11:33:44 +0530 Subject: [PATCH 5/5] fix: correct formatting in Azure Monitor configuration options --- src/backend/api/api_routes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/api/api_routes.py b/src/backend/api/api_routes.py index 8d0dbdc5..008e3f13 100644 --- a/src/backend/api/api_routes.py +++ b/src/backend/api/api_routes.py @@ -47,7 +47,7 @@ configure_azure_monitor( connection_string=instrumentation_key, instrumentation_options={ - "azure_sdk": {"enabled": False}, + "azure_sdk": {"enabled": False}, } ) logging.info(