diff --git a/infra/main.bicep b/infra/main.bicep index 830e943b4..b523275fb 100644 --- a/infra/main.bicep +++ b/infra/main.bicep @@ -460,12 +460,6 @@ var dnsZoneIndex = { sqlServer: 9 search: 10 } -// List of DNS zone indices that correspond to AI-related services. -var aiRelatedDnsZoneIndices = [ - dnsZoneIndex.cognitiveServices - dnsZoneIndex.openAI - dnsZoneIndex.aiServices -] // =================================================== // DEPLOY PRIVATE DNS ZONES @@ -1575,6 +1569,9 @@ module webSiteBackend 'modules/web-sites.bicep' = { SOLUTION_NAME: solutionSuffix APP_ENV: 'Prod' AZURE_CLIENT_ID: backendUserAssignedIdentity.outputs.clientId + AZURE_BASIC_LOGGING_LEVEL: 'INFO' + AZURE_PACKAGE_LOGGING_LEVEL: 'WARNING' + AZURE_LOGGING_PACKAGES: '' } // WAF aligned configuration for Monitoring applicationInsightResourceId: enableMonitoring ? applicationInsights!.outputs.resourceId : null diff --git a/infra/main.json b/infra/main.json index 55222e5d0..f671ecbec 100644 --- a/infra/main.json +++ b/infra/main.json @@ -5,8 +5,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "18267085918254210296" + "version": "0.37.4.10188", + "templateHash": "4682612971990946423" } }, "parameters": { @@ -359,11 +359,6 @@ "sqlServer": 9, "search": 10 }, - "aiRelatedDnsZoneIndices": [ - "[variables('dnsZoneIndex').cognitiveServices]", - "[variables('dnsZoneIndex').openAI]", - "[variables('dnsZoneIndex').aiServices]" - ], "userAssignedIdentityResourceName": "[format('id-{0}', variables('solutionSuffix'))]", "backendUserAssignedIdentityResourceName": "[format('id-backend-{0}', variables('solutionSuffix'))]", "keyVaultName": "[format('kv-{0}', variables('solutionSuffix'))]", @@ -504,7 +499,7 @@ "logAnalyticsWorkspace": { "condition": "[and(parameters('enableMonitoring'), not(variables('useExistingLogAnalytics')))]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.operational-insights.workspace.{0}', variables('logAnalyticsWorkspaceResourceName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -3610,7 +3605,7 @@ "applicationInsights": { "condition": "[parameters('enableMonitoring')]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.insights.component.{0}', variables('applicationInsightsResourceName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -4341,7 +4336,7 @@ "virtualNetwork": { "condition": "[parameters('enablePrivateNetworking')]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('module.virtualNetwork.{0}', variables('solutionSuffix')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -4378,8 +4373,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "16551195719711772164" + "version": "0.37.4.10188", + "templateHash": "150702682969982307" } }, "definitions": { @@ -4786,7 +4781,7 @@ }, "condition": "[not(empty(tryGet(parameters('subnets')[copyIndex()], 'networkSecurityGroup')))]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.network.network-security-group.{0}.{1}', tryGet(parameters('subnets')[copyIndex()], 'networkSecurityGroup', 'name'), parameters('resourceSuffix')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -5438,7 +5433,7 @@ }, "virtualNetwork": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.network.virtual-network.{0}', parameters('name')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -7169,7 +7164,7 @@ "bastionHost": { "condition": "[parameters('enablePrivateNetworking')]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.network.bastion-host.{0}', variables('bastionHostName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -8488,7 +8483,7 @@ "jumpboxVM": { "condition": "[parameters('enablePrivateNetworking')]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.compute.virtual-machine.{0}', variables('jumpboxVmName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -16838,7 +16833,7 @@ }, "condition": "[parameters('enablePrivateNetworking')]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[format('avm.res.network.private-dns-zone.{0}', split(variables('privateDnsZones')[copyIndex()], '.')[1])]", "properties": { "expressionEvaluationOptions": { @@ -20005,7 +20000,7 @@ }, "userAssignedIdentity": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.managed-identity.user-assigned-identity.{0}', variables('userAssignedIdentityResourceName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -20487,7 +20482,7 @@ }, "backendUserAssignedIdentity": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.managed-identity.user-assigned-identity.{0}', variables('backendUserAssignedIdentityResourceName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -20969,7 +20964,7 @@ }, "keyvault": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.key-vault.vault.{0}', variables('keyVaultName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -21040,7 +21035,7 @@ }, { "name": "AZURE-COSMOSDB-ACCOUNT-KEY", - "value": "[listOutputsWithSecureValues('cosmosDb', '2025-04-01').primaryReadWriteKey]" + "value": "[listOutputsWithSecureValues('cosmosDb', '2022-09-01').primaryReadWriteKey]" }, { "name": "AZURE-COSMOSDB-DATABASE", @@ -21064,7 +21059,7 @@ }, { "name": "ADLS-ACCOUNT-KEY", - "value": "[listOutputsWithSecureValues('storageAccount', '2025-04-01').primaryAccessKey]" + "value": "[listOutputsWithSecureValues('storageAccount', '2022-09-01').primaryAccessKey]" }, { "name": "AZURE-SEARCH-ENDPOINT", @@ -24276,7 +24271,7 @@ "aiFoundryAiServices": { "condition": "[variables('aiFoundryAIservicesEnabled')]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.cognitive-services.account.{0}', variables('aiFoundryAiServicesResourceName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -24405,8 +24400,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "13577584254455791464" + "version": "0.37.4.10188", + "templateHash": "9302733089815614062" }, "name": "Cognitive Services", "description": "This module deploys a Cognitive Service." @@ -25586,7 +25581,7 @@ "cognitive_service_dependencies": { "condition": "[not(variables('useExistingService'))]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[format('cognitive_service_dependencies-{0}', uniqueString('cognitive_service_dependencies', deployment().name))]", "properties": { "expressionEvaluationOptions": { @@ -25638,8 +25633,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "12629047609675461422" + "version": "0.37.4.10188", + "templateHash": "13864482829550647329" } }, "definitions": { @@ -26678,7 +26673,7 @@ "count": "[length(coalesce(parameters('privateEndpoints'), createArray()))]" }, "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[format('{0}-cognitiveService-PrivateEndpoint-{1}', uniqueString(deployment().name, parameters('location')), copyIndex())]", "subscriptionId": "[split(coalesce(tryGet(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()], 'resourceGroupResourceId'), resourceGroup().id), '/')[2]]", "resourceGroup": "[split(coalesce(tryGet(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()], 'resourceGroupResourceId'), resourceGroup().id), '/')[4]]", @@ -27429,7 +27424,7 @@ "secretsExport": { "condition": "[not(equals(parameters('secretsExportConfiguration'), null()))]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[format('{0}-secrets-kv', uniqueString(deployment().name, parameters('location')))]", "subscriptionId": "[split(tryGet(parameters('secretsExportConfiguration'), 'keyVaultResourceId'), '/')[2]]", "resourceGroup": "[split(tryGet(parameters('secretsExportConfiguration'), 'keyVaultResourceId'), '/')[4]]", @@ -27453,8 +27448,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "4291957610087788581" + "version": "0.37.4.10188", + "templateHash": "2491273843075489892" } }, "definitions": { @@ -27573,7 +27568,7 @@ "aiProject": { "condition": "[or(not(empty(parameters('projectName'))), not(empty(parameters('existingFoundryProjectResourceId'))))]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('{0}-ai-project-{1}-deployment', parameters('name'), parameters('projectName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -27607,8 +27602,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "13987065577218259048" + "version": "0.37.4.10188", + "templateHash": "7781450680156271399" } }, "definitions": { @@ -27787,7 +27782,7 @@ "existing_cognitive_service_dependencies": { "condition": "[variables('useExistingService')]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[format('existing_cognitive_service_dependencies-{0}', uniqueString('existing_cognitive_service_dependencies', deployment().name))]", "subscriptionId": "[variables('existingCognitiveServiceDetails')[2]]", "resourceGroup": "[variables('existingCognitiveServiceDetails')[4]]", @@ -27844,8 +27839,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "12629047609675461422" + "version": "0.37.4.10188", + "templateHash": "13864482829550647329" } }, "definitions": { @@ -28884,7 +28879,7 @@ "count": "[length(coalesce(parameters('privateEndpoints'), createArray()))]" }, "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[format('{0}-cognitiveService-PrivateEndpoint-{1}', uniqueString(deployment().name, parameters('location')), copyIndex())]", "subscriptionId": "[split(coalesce(tryGet(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()], 'resourceGroupResourceId'), resourceGroup().id), '/')[2]]", "resourceGroup": "[split(coalesce(tryGet(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()], 'resourceGroupResourceId'), resourceGroup().id), '/')[4]]", @@ -29635,7 +29630,7 @@ "secretsExport": { "condition": "[not(equals(parameters('secretsExportConfiguration'), null()))]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[format('{0}-secrets-kv', uniqueString(deployment().name, parameters('location')))]", "subscriptionId": "[split(tryGet(parameters('secretsExportConfiguration'), 'keyVaultResourceId'), '/')[2]]", "resourceGroup": "[split(tryGet(parameters('secretsExportConfiguration'), 'keyVaultResourceId'), '/')[4]]", @@ -29659,8 +29654,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "4291957610087788581" + "version": "0.37.4.10188", + "templateHash": "2491273843075489892" } }, "definitions": { @@ -29779,7 +29774,7 @@ "aiProject": { "condition": "[or(not(empty(parameters('projectName'))), not(empty(parameters('existingFoundryProjectResourceId'))))]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('{0}-ai-project-{1}-deployment', parameters('name'), parameters('projectName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -29813,8 +29808,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "13987065577218259048" + "version": "0.37.4.10188", + "templateHash": "7781450680156271399" } }, "definitions": { @@ -30082,7 +30077,7 @@ }, "cognitiveServicesCu": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.cognitive-services.account.{0}', variables('aiFoundryAiServicesCUResourceName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -32400,9 +32395,9 @@ } }, "dependsOn": [ - "[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').cognitiveServices)]", - "[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').aiServices)]", "[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').openAI)]", + "[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').aiServices)]", + "[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').cognitiveServices)]", "logAnalyticsWorkspace", "userAssignedIdentity", "virtualNetwork" @@ -32410,7 +32405,7 @@ }, "searchSearchServices": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.search.search-service.{0}', variables('aiSearchName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -34806,7 +34801,7 @@ "existing_AIProject_SearchConnectionModule": { "condition": "[variables('useExistingAiFoundryAiProject')]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "aiProjectSearchConnectionDeployment", "subscriptionId": "[variables('aiFoundryAiServicesSubscriptionId')]", "resourceGroup": "[variables('aiFoundryAiServicesResourceGroupName')]", @@ -34841,8 +34836,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "904007681755275486" + "version": "0.37.4.10188", + "templateHash": "6038840175458269917" } }, "parameters": { @@ -34910,7 +34905,7 @@ "searchServiceToExistingAiServicesRoleAssignment": { "condition": "[variables('useExistingAiFoundryAiProject')]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "searchToExistingAiServices-roleAssignment", "subscriptionId": "[variables('aiFoundryAiServicesSubscriptionId')]", "resourceGroup": "[variables('aiFoundryAiServicesResourceGroupName')]", @@ -34936,8 +34931,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "10276790018915749779" + "version": "0.37.4.10188", + "templateHash": "3644919950024112374" } }, "parameters": { @@ -34987,7 +34982,7 @@ }, "storageAccount": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.storage.storage-account.{0}', variables('storageAccountName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -40772,9 +40767,9 @@ } }, "dependsOn": [ - "[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').storageFile)]", "[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').storageBlob)]", "[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').storageQueue)]", + "[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').storageFile)]", "[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').storageDfs)]", "userAssignedIdentity", "virtualNetwork" @@ -40782,7 +40777,7 @@ }, "cosmosDb": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.document-db.database-account.{0}', variables('cosmosDbResourceName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -44621,7 +44616,7 @@ }, "sqlDBModule": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.sql.server.{0}', variables('sqlServerResourceName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -51265,7 +51260,7 @@ }, "uploadFiles": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take('avm.res.resources.deployment-script.uploadFiles', 64)]", "properties": { "expressionEvaluationOptions": { @@ -51849,7 +51844,7 @@ }, "createIndex": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take('avm.res.resources.deployment-script.createIndex', 64)]", "properties": { "expressionEvaluationOptions": { @@ -52436,7 +52431,7 @@ }, "createSqlUserAndRole": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take('avm.res.resources.deployment-script.createSqlUserAndRole', 64)]", "properties": { "expressionEvaluationOptions": { @@ -53022,7 +53017,7 @@ }, "webServerFarm": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "deploy_app_service_plan_serverfarm", "properties": { "expressionEvaluationOptions": { @@ -53593,7 +53588,7 @@ }, "webSiteBackend": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('module.web-sites.{0}', variables('backendWebSiteResourceName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -53660,7 +53655,10 @@ "DUMMY_TEST": "True", "SOLUTION_NAME": "[variables('solutionSuffix')]", "APP_ENV": "Prod", - "AZURE_CLIENT_ID": "[reference('backendUserAssignedIdentity').outputs.clientId.value]" + "AZURE_CLIENT_ID": "[reference('backendUserAssignedIdentity').outputs.clientId.value]", + "AZURE_BASIC_LOGGING_LEVEL": "INFO", + "AZURE_PACKAGE_LOGGING_LEVEL": "WARNING", + "AZURE_LOGGING_PACKAGES": "" }, "applicationInsightResourceId": "[if(parameters('enableMonitoring'), reference('applicationInsights').outputs.resourceId.value, null())]" } @@ -53681,8 +53679,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "13074777962389399773" + "version": "0.37.4.10188", + "templateHash": "4298119334635398540" } }, "definitions": { @@ -54659,7 +54657,7 @@ "count": "[length(coalesce(parameters('configs'), createArray()))]" }, "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[format('{0}-Site-Config-{1}', uniqueString(deployment().name, parameters('location')), copyIndex())]", "properties": { "expressionEvaluationOptions": { @@ -54694,8 +54692,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "11666262061409473778" + "version": "0.37.4.10188", + "templateHash": "4653685834544796273" }, "name": "Site App Settings", "description": "This module deploys a Site App Setting." @@ -54840,7 +54838,7 @@ "count": "[length(coalesce(parameters('privateEndpoints'), createArray()))]" }, "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[format('{0}-app-PrivateEndpoint-{1}', uniqueString(deployment().name, parameters('location')), copyIndex())]", "subscriptionId": "[split(coalesce(tryGet(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()], 'resourceGroupResourceId'), resourceGroup().id), '/')[2]]", "resourceGroup": "[split(coalesce(tryGet(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()], 'resourceGroupResourceId'), resourceGroup().id), '/')[4]]", @@ -55666,7 +55664,7 @@ }, "webSiteFrontend": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('module.web-sites.{0}', variables('webSiteResourceName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -55721,8 +55719,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "13074777962389399773" + "version": "0.37.4.10188", + "templateHash": "4298119334635398540" } }, "definitions": { @@ -56699,7 +56697,7 @@ "count": "[length(coalesce(parameters('configs'), createArray()))]" }, "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[format('{0}-Site-Config-{1}', uniqueString(deployment().name, parameters('location')), copyIndex())]", "properties": { "expressionEvaluationOptions": { @@ -56734,8 +56732,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "11666262061409473778" + "version": "0.37.4.10188", + "templateHash": "4653685834544796273" }, "name": "Site App Settings", "description": "This module deploys a Site App Setting." @@ -56880,7 +56878,7 @@ "count": "[length(coalesce(parameters('privateEndpoints'), createArray()))]" }, "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[format('{0}-app-PrivateEndpoint-{1}', uniqueString(deployment().name, parameters('location')), copyIndex())]", "subscriptionId": "[split(coalesce(tryGet(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()], 'resourceGroupResourceId'), resourceGroup().id), '/')[2]]", "resourceGroup": "[split(coalesce(tryGet(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()], 'resourceGroupResourceId'), resourceGroup().id), '/')[4]]", diff --git a/src/api/.env.sample b/src/api/.env.sample index 88fc57119..a6499abad 100644 --- a/src/api/.env.sample +++ b/src/api/.env.sample @@ -24,3 +24,10 @@ SQLDB_DATABASE= SQLDB_SERVER= USE_CHAT_HISTORY_ENABLED="True" APP_ENV="dev" +# Basic application logging (default: INFO level) +AZURE_BASIC_LOGGING_LEVEL=INFO +# Azure package logging (default: WARNING level to suppress INFO) +AZURE_PACKAGE_LOGGING_LEVEL=WARNING +# Comma-separated list of specific logger names to configure (default: empty - no custom loggers) +# Example: AZURE_LOGGING_PACKAGES=azure.identity.aio._internal,azure.monitor.opentelemetry.exporter.export._base +AZURE_LOGGING_PACKAGES= diff --git a/src/api/api/api_routes.py b/src/api/api/api_routes.py index 80cf483a2..dec6960c3 100644 --- a/src/api/api/api_routes.py +++ b/src/api/api/api_routes.py @@ -18,8 +18,6 @@ router = APIRouter() -# Configure logging -logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) # Check if the Application Insights Instrumentation Key is set in the environment variables @@ -32,20 +30,6 @@ # Log a warning if the Instrumentation Key is not found logging.warning("No Application Insights Instrumentation Key found. Skipping configuration") -# Configure logging -logging.basicConfig(level=logging.INFO) - -# Suppress INFO logs from 'azure.core.pipeline.policies.http_logging_policy' -logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel( - logging.WARNING -) -logging.getLogger("azure.identity.aio._internal").setLevel(logging.WARNING) - -# Suppress info logs from OpenTelemetry exporter -logging.getLogger("azure.monitor.opentelemetry.exporter.export._base").setLevel( - logging.WARNING -) - @router.get("/fetchChartData") async def fetch_chart_data(): diff --git a/src/api/api/history_routes.py b/src/api/api/history_routes.py index a16ef459d..7f1cfef5a 100644 --- a/src/api/api/history_routes.py +++ b/src/api/api/history_routes.py @@ -11,8 +11,6 @@ router = APIRouter() -# Configure logging -logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) # Check if the Application Insights Instrumentation Key is set in the environment variables @@ -25,20 +23,6 @@ # Log a warning if the Instrumentation Key is not found logging.warning("No Application Insights Instrumentation Key found. Skipping configuration") -# Configure logging -logging.basicConfig(level=logging.INFO) - -# Suppress INFO logs from 'azure.core.pipeline.policies.http_logging_policy' -logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel( - logging.WARNING -) -logging.getLogger("azure.identity.aio._internal").setLevel(logging.WARNING) - -# Suppress info logs from OpenTelemetry exporter -logging.getLogger("azure.monitor.opentelemetry.exporter.export._base").setLevel( - logging.WARNING -) - # Single instance of HistoryService (if applicable) history_service = HistoryService() diff --git a/src/api/app.py b/src/api/app.py index 2ba6f1158..c91e5fbc9 100644 --- a/src/api/app.py +++ b/src/api/app.py @@ -7,6 +7,8 @@ """ +import logging +import os from contextlib import asynccontextmanager from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware @@ -21,8 +23,29 @@ from api.api_routes import router as backend_router from api.history_routes import router as history_router +# Load environment variables load_dotenv() +# Configure logging +# Basic application logging (default: INFO level) +AZURE_BASIC_LOGGING_LEVEL = os.getenv("AZURE_BASIC_LOGGING_LEVEL", "INFO").upper() +# Azure package logging (default: WARNING level to suppress INFO) +AZURE_PACKAGE_LOGGING_LEVEL = os.getenv("AZURE_PACKAGE_LOGGING_LEVEL", "WARNING").upper() +# Azure logging packages (default: empty list) +AZURE_LOGGING_PACKAGES = [ + pkg.strip() for pkg in os.getenv("AZURE_LOGGING_PACKAGES", "").split(",") if pkg.strip() +] + +# Basic config: logging.basicConfig(level=logging.INFO) +logging.basicConfig( + level=getattr(logging, AZURE_BASIC_LOGGING_LEVEL, logging.INFO), + format='%(asctime)s - %(name)s - %(levelname)s - %(message)s' +) + +# Package config: Azure loggers set to WARNING to suppress INFO +for logger_name in AZURE_LOGGING_PACKAGES: + logging.getLogger(logger_name).setLevel(getattr(logging, AZURE_PACKAGE_LOGGING_LEVEL, logging.WARNING)) + @asynccontextmanager async def lifespan(fastapi_app: FastAPI): diff --git a/src/api/helpers/utils.py b/src/api/helpers/utils.py index 4c7511d4d..ce854d8c9 100644 --- a/src/api/helpers/utils.py +++ b/src/api/helpers/utils.py @@ -5,10 +5,6 @@ import requests -DEBUG = os.environ.get("DEBUG", "false") -if DEBUG.lower() == "true": - logging.basicConfig(level=logging.DEBUG) - AZURE_SEARCH_PERMITTED_GROUPS_COLUMN = os.environ.get( "AZURE_SEARCH_PERMITTED_GROUPS_COLUMN" ) diff --git a/src/api/services/chart_service.py b/src/api/services/chart_service.py index e1e22a2a3..0b2e60861 100644 --- a/src/api/services/chart_service.py +++ b/src/api/services/chart_service.py @@ -4,8 +4,6 @@ from api.models.input_models import ChartFilters from common.database.sqldb_service import adjust_processed_data_dates, fetch_chart_data, fetch_filters_data -# Configure logging -logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) diff --git a/src/api/services/chat_service.py b/src/api/services/chat_service.py index 2bb55866f..6ddce2e64 100644 --- a/src/api/services/chat_service.py +++ b/src/api/services/chat_service.py @@ -28,8 +28,6 @@ HOST_NAME = "CKM" HOST_INSTRUCTIONS = "Answer questions about call center operations" -# Configure logging -logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) diff --git a/src/api/services/history_service.py b/src/api/services/history_service.py index a04d60d83..39000d7e5 100644 --- a/src/api/services/history_service.py +++ b/src/api/services/history_service.py @@ -8,8 +8,6 @@ from common.database.cosmosdb_service import CosmosConversationClient from helpers.azure_credential_utils import get_azure_credential -# Configure logging -logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__)