diff --git a/docs/CustomizingAzdParameters.md b/docs/CustomizingAzdParameters.md index 1112a84f..b74a1b48 100644 --- a/docs/CustomizingAzdParameters.md +++ b/docs/CustomizingAzdParameters.md @@ -3,7 +3,7 @@ By default this template will use the environment name as the prefix to prevent naming collisions within Azure. The parameters below show the default values. You only need to run the statements below if you need to change the values. -> To override any of the parameters, run `azd env set ` before running `azd up`. On the first azd command, it will prompt you for the environment name. Be sure to choose 3-20 charaters alphanumeric unique name. +> To override any of the parameters, run `azd env set ` before running `azd up`. On the first azd command, it will prompt you for the environment name. Be sure to choose 3-20 characters alphanumeric unique name. ## Parameters diff --git a/infra/main.bicep b/infra/main.bicep index eeddf416..1acdaec7 100644 --- a/infra/main.bicep +++ b/infra/main.bicep @@ -1122,6 +1122,9 @@ module webSite 'modules/web-sites.bicep' = { AZURE_SEARCH_STRICTNESS: azureSearchStrictness AZURE_OPENAI_EMBEDDING_NAME: embeddingModel AZURE_OPENAI_EMBEDDING_ENDPOINT : aiFoundryAiServices.outputs.endpoint + AZURE_BASIC_LOGGING_LEVEL: 'INFO' + AZURE_PACKAGE_LOGGING_LEVEL: 'WARNING' + AZURE_LOGGING_PACKAGES: '' SQLDB_SERVER: sqlServerFqdn SQLDB_DATABASE: sqlDbName USE_INTERNAL_STREAM: useInternalStream diff --git a/infra/main.json b/infra/main.json index ba13a0b5..515dc388 100644 --- a/infra/main.json +++ b/infra/main.json @@ -5,8 +5,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "8399698956794037004" + "version": "0.37.4.10188", + "templateHash": "10200691163213391924" } }, "parameters": { @@ -456,7 +456,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": { @@ -3562,7 +3562,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": { @@ -4292,7 +4292,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": { @@ -4774,7 +4774,7 @@ }, "sqlUserAssignedIdentity": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.managed-identity.user-assigned-identity.{0}', variables('sqlUserAssignedIdentityResourceName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -5257,7 +5257,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": { @@ -5294,8 +5294,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "14641679443140532549" + "version": "0.37.4.10188", + "templateHash": "15908341678380884075" } }, "definitions": { @@ -5688,7 +5688,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": { @@ -6340,7 +6340,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": { @@ -8067,7 +8067,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": { @@ -9386,7 +9386,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": { @@ -17736,7 +17736,7 @@ }, "condition": "[and(parameters('enablePrivateNetworking'), or(empty(parameters('existingFoundryProjectResourceId')), not(contains(variables('aiRelatedDnsZoneIndices'), copyIndex()))))]", "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": { @@ -20903,7 +20903,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": { @@ -24135,7 +24135,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": { @@ -24250,8 +24250,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "1936381873810101836" + "version": "0.37.4.10188", + "templateHash": "11586648700335054863" }, "name": "Cognitive Services", "description": "This module deploys a Cognitive Service." @@ -25431,7 +25431,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": { @@ -25483,8 +25483,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "17351518472581919759" + "version": "0.37.4.10188", + "templateHash": "8352858209491089788" } }, "definitions": { @@ -26521,7 +26521,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]]", @@ -27272,7 +27272,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]]", @@ -27296,8 +27296,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "4291957610087788581" + "version": "0.37.4.10188", + "templateHash": "2491273843075489892" } }, "definitions": { @@ -27416,7 +27416,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": { @@ -27450,8 +27450,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "5108472911734987415" + "version": "0.37.4.10188", + "templateHash": "346451728741152022" } }, "definitions": { @@ -27630,7 +27630,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]]", @@ -27687,8 +27687,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "17351518472581919759" + "version": "0.37.4.10188", + "templateHash": "8352858209491089788" } }, "definitions": { @@ -28725,7 +28725,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]]", @@ -29476,7 +29476,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]]", @@ -29500,8 +29500,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "4291957610087788581" + "version": "0.37.4.10188", + "templateHash": "2491273843075489892" } }, "definitions": { @@ -29620,7 +29620,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": { @@ -29654,8 +29654,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "5108472911734987415" + "version": "0.37.4.10188", + "templateHash": "346451728741152022" } }, "definitions": { @@ -29921,7 +29921,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": { @@ -33761,7 +33761,7 @@ }, "avmStorageAccount": { "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": { @@ -39522,8 +39522,8 @@ } }, "dependsOn": [ - "[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').storageQueue)]", "[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').storageBlob)]", + "[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').storageQueue)]", "keyvault", "userAssignedIdentity", "virtualNetwork" @@ -39531,7 +39531,7 @@ }, "saveStorageAccountSecretsInKeyVault": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('saveStorageAccountSecretsInKeyVault.{0}', variables('keyVaultName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -39575,7 +39575,7 @@ }, { "name": "ADLS-ACCOUNT-KEY", - "value": "[listOutputsWithSecureValues('avmStorageAccount', '2025-04-01').primaryAccessKey]" + "value": "[listOutputsWithSecureValues('avmStorageAccount', '2022-09-01').primaryAccessKey]" } ] } @@ -42703,7 +42703,7 @@ }, "sqlDBModule": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.sql.server.{0}', variables('sqlDbName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -49345,7 +49345,7 @@ }, "webServerFarm": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.web.serverfarm.{0}', variables('webServerFarmResourceName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -49918,7 +49918,7 @@ }, "webSite": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('module.web-sites.{0}', variables('webSiteResourceName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -49989,6 +49989,9 @@ "AZURE_SEARCH_STRICTNESS": "[variables('azureSearchStrictness')]", "AZURE_OPENAI_EMBEDDING_NAME": "[parameters('embeddingModel')]", "AZURE_OPENAI_EMBEDDING_ENDPOINT": "[reference('aiFoundryAiServices').outputs.endpoint.value]", + "AZURE_BASIC_LOGGING_LEVEL": "INFO", + "AZURE_PACKAGE_LOGGING_LEVEL": "WARNING", + "AZURE_LOGGING_PACKAGES": "", "SQLDB_SERVER": "[variables('sqlServerFqdn')]", "SQLDB_DATABASE": "[variables('sqlDbName')]", "USE_INTERNAL_STREAM": "[variables('useInternalStream')]", @@ -50027,8 +50030,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "13074777962389399773" + "version": "0.37.4.10188", + "templateHash": "4298119334635398540" } }, "definitions": { @@ -51005,7 +51008,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": { @@ -51040,8 +51043,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." @@ -51186,7 +51189,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]]", @@ -52012,7 +52015,7 @@ }, "searchService": { "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": { @@ -54392,7 +54395,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')]", @@ -54427,8 +54430,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "904007681755275486" + "version": "0.37.4.10188", + "templateHash": "6038840175458269917" } }, "parameters": { @@ -54496,7 +54499,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')]", @@ -54522,8 +54525,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.39.26.7824", - "templateHash": "10276790018915749779" + "version": "0.37.4.10188", + "templateHash": "3644919950024112374" } }, "parameters": { diff --git a/infra/main_custom.bicep b/infra/main_custom.bicep index 160358b1..01261e0b 100644 --- a/infra/main_custom.bicep +++ b/infra/main_custom.bicep @@ -1126,6 +1126,9 @@ module webSite 'modules/web-sites.bicep' = { AZURE_SEARCH_STRICTNESS: azureSearchStrictness AZURE_OPENAI_EMBEDDING_NAME: embeddingModel AZURE_OPENAI_EMBEDDING_ENDPOINT : aiFoundryAiServices.outputs.endpoint + AZURE_BASIC_LOGGING_LEVEL: 'INFO' + AZURE_PACKAGE_LOGGING_LEVEL: 'WARNING' + AZURE_LOGGING_PACKAGES: '' SQLDB_SERVER: sqlServerFqdn SQLDB_DATABASE: sqlDbName USE_INTERNAL_STREAM: useInternalStream diff --git a/src/App/.env.sample b/src/App/.env.sample index 53ae69bf..3ad8478a 100644 --- a/src/App/.env.sample +++ b/src/App/.env.sample @@ -12,6 +12,11 @@ AZURE_OPENAI_ENDPOINT= AZURE_OPENAI_EMBEDDING_NAME="text-embedding-ada-002" AZURE_OPENAI_EMBEDDING_ENDPOINT= +# Logging settings +AZURE_BASIC_LOGGING_LEVEL="INFO" +AZURE_PACKAGE_LOGGING_LEVEL="WARNING" +# AZURE_LOGGING_PACKAGES="azure.core.pipeline.policies.http_logging_policy,azure.identity.aio._internal,azure.monitor.opentelemetry.exporter.export._base" + # User Interface UI_TITLE= UI_LOGO= diff --git a/src/App/app.py b/src/App/app.py index 0f154083..db09862e 100644 --- a/src/App/app.py +++ b/src/App/app.py @@ -56,18 +56,23 @@ ) # Configure logging -logging.basicConfig(level=logging.INFO) +basic_level = getattr( + logging, config.AZURE_BASIC_LOGGING_LEVEL.upper(), logging.INFO +) +logging.basicConfig(level=basic_level) -# Suppress INFO logs from 'azure.core.pipeline.policies.http_logging_policy' -logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel( - logging.WARNING +# Configure Azure package logging levels +azure_packages_env = os.environ.get("AZURE_LOGGING_PACKAGES") +azure_packages = ( + [pkg.strip() for pkg in azure_packages_env.split(',') if pkg.strip()] + if azure_packages_env else [] ) -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 +package_level = getattr( + logging, config.AZURE_PACKAGE_LOGGING_LEVEL.upper(), logging.WARNING ) +for package in azure_packages: + logging.getLogger(package).setLevel(package_level) def create_app(): diff --git a/src/App/backend/common/config.py b/src/App/backend/common/config.py index 49775830..b3e33ae0 100644 --- a/src/App/backend/common/config.py +++ b/src/App/backend/common/config.py @@ -35,6 +35,14 @@ def __init__(self): "APPLICATIONINSIGHTS_CONNECTION_STRING" ) + # Azure Logging Configuration + self.AZURE_BASIC_LOGGING_LEVEL = os.environ.get( + "AZURE_BASIC_LOGGING_LEVEL", "INFO" + ) + self.AZURE_PACKAGE_LOGGING_LEVEL = os.environ.get( + "AZURE_PACKAGE_LOGGING_LEVEL", "WARNING" + ) + self.DEBUG = os.environ.get("DEBUG", "false") # Current minimum Azure OpenAI version supported