@@ -48,6 +48,28 @@ function Get-ValuesFromAzdEnv {
4848 return $true
4949}
5050
51+ function Get-DeploymentValue {
52+ param (
53+ [object ]$DeploymentOutputs ,
54+ [string ]$PrimaryKey ,
55+ [string ]$FallbackKey
56+ )
57+
58+ $value = $null
59+
60+ # Try primary key first
61+ if ($DeploymentOutputs.PSObject.Properties [$PrimaryKey ]) {
62+ $value = $DeploymentOutputs .$PrimaryKey.value
63+ }
64+
65+ # If primary key failed, try fallback key
66+ if (-not $value -and $DeploymentOutputs.PSObject.Properties [$FallbackKey ]) {
67+ $value = $DeploymentOutputs .$FallbackKey.value
68+ }
69+
70+ return $value
71+ }
72+
5173function Get-ValuesFromAzDeployment {
5274 Write-Host " Getting values from Azure deployment outputs..."
5375
@@ -67,12 +89,12 @@ function Get-ValuesFromAzDeployment {
6789 return $false
6890 }
6991
70- # Extract specific outputs
71- $script :storageAccount = $deploymentOutputs. azurE_STORAGE_ACCOUNT_NAME.value
72- $script :blobContainer = $deploymentOutputs. azurE_STORAGE_CONTAINER_NAME.value
73- $script :aiSearch = $deploymentOutputs. azurE_AI_SEARCH_NAME.value
74- $script :aiSearchIndex = $deploymentOutputs. azurE_AI_SEARCH_INDEX_NAME.value
75- $script :backendUrl = $deploymentOutputs. backenD_URL.value
92+ # Extract specific outputs with fallback logic
93+ $script :storageAccount = Get-DeploymentValue - DeploymentOutputs $deploymentOutputs - PrimaryKey " azurE_STORAGE_ACCOUNT_NAME" - FallbackKey " azureStorageAccountName "
94+ $script :blobContainer = Get-DeploymentValue - DeploymentOutputs $deploymentOutputs - PrimaryKey " azurE_STORAGE_CONTAINER_NAME" - FallbackKey " azureStorageContainerName "
95+ $script :aiSearch = Get-DeploymentValue - DeploymentOutputs $deploymentOutputs - PrimaryKey " azurE_AI_SEARCH_NAME" - FallbackKey " azureAiSearchName "
96+ $script :aiSearchIndex = Get-DeploymentValue - DeploymentOutputs $deploymentOutputs - PrimaryKey " azurE_AI_SEARCH_INDEX_NAME" - FallbackKey " azureAiSearchIndexName "
97+ $script :backendUrl = Get-DeploymentValue - DeploymentOutputs $deploymentOutputs - PrimaryKey " backenD_URL" - FallbackKey " backendUrl "
7698
7799 # Validate that we extracted all required values
78100 if (-not $script :storageAccount -or -not $script :blobContainer -or -not $script :aiSearch -or -not $script :aiSearchIndex -or -not $script :backendUrl ) {
0 commit comments