From 4773c6fda807817cd76279987381091fb4524ccd Mon Sep 17 00:00:00 2001 From: NirajC3-Microsoft Date: Tue, 4 Aug 2026 18:36:41 +0530 Subject: [PATCH] chore: update run_agents_script to get values from deployment --- .../agent_scripts/run_create_agents_scripts.ps1 | 8 ++++++++ .../agent_scripts/run_create_agents_scripts.sh | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/infra/scripts/post-provision/agent_scripts/run_create_agents_scripts.ps1 b/infra/scripts/post-provision/agent_scripts/run_create_agents_scripts.ps1 index 39404610..64062c2d 100644 --- a/infra/scripts/post-provision/agent_scripts/run_create_agents_scripts.ps1 +++ b/infra/scripts/post-provision/agent_scripts/run_create_agents_scripts.ps1 @@ -139,6 +139,14 @@ function Get-ValuesFromAzDeployment { $script:gptModelName = Get-DeploymentValue -DeploymentOutputs $deploymentOutputs -PrimaryKey "azureAiAgentModelDeploymentName" -FallbackKey "AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME" $script:aiFoundryResourceId = Get-DeploymentValue -DeploymentOutputs $deploymentOutputs -PrimaryKey "aiFoundryResourceId" -FallbackKey "AI_FOUNDRY_RESOURCE_ID" $script:apiAppName = Get-DeploymentValue -DeploymentOutputs $deploymentOutputs -PrimaryKey "apiAppName" -FallbackKey "API_APP_NAME" + # Fallback: try additional output key names used by AVM deployments + if (-not $script:apiAppName) { + $script:apiAppName = Get-DeploymentValue -DeploymentOutputs $deploymentOutputs -PrimaryKey "chatApiAppName" -FallbackKey "CHAT_API_APP_NAME" + } + # Final fallback: derive from solutionName using known naming convention + if (-not $script:apiAppName -and $script:solutionName) { + $script:apiAppName = "api-chat-$($script:solutionName)" + } $script:searchEndpoint = Get-DeploymentValue -DeploymentOutputs $deploymentOutputs -PrimaryKey "azureAiSearchEndpoint" -FallbackKey "AZURE_AI_SEARCH_ENDPOINT" # Validate that we extracted all required values diff --git a/infra/scripts/post-provision/agent_scripts/run_create_agents_scripts.sh b/infra/scripts/post-provision/agent_scripts/run_create_agents_scripts.sh index 004e9c23..6c21d877 100644 --- a/infra/scripts/post-provision/agent_scripts/run_create_agents_scripts.sh +++ b/infra/scripts/post-provision/agent_scripts/run_create_agents_scripts.sh @@ -109,6 +109,14 @@ function get_values_from_az_deployment() { gptModelName=$(extract_value "azureAiAgentModelDeploymentName" "AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME") aiFoundryResourceId=$(extract_value "aiFoundryResourceId" "AI_FOUNDRY_RESOURCE_ID") apiAppName=$(extract_value "apiAppName" "API_APP_NAME") + # Fallback: try additional output key names used by AVM deployments + if [[ -z "$apiAppName" ]]; then + apiAppName=$(extract_value "chatApiAppName" "CHAT_API_APP_NAME") + fi + # Final fallback: derive from solutionName using known naming convention + if [[ -z "$apiAppName" && -n "$solutionName" ]]; then + apiAppName="api-chat-${solutionName}" + fi searchEndpoint=$(extract_value "azureAiSearchEndpoint" "AZURE_AI_SEARCH_ENDPOINT") # Debug output