@@ -76,6 +76,28 @@ function Get-ValuesFromAzdEnv {
7676 return $true
7777}
7878
79+ function Get-DeploymentValue {
80+ param (
81+ [object ]$DeploymentOutputs ,
82+ [string ]$PrimaryKey ,
83+ [string ]$FallbackKey
84+ )
85+
86+ $value = $null
87+
88+ # Try primary key first
89+ if ($DeploymentOutputs.PSObject.Properties [$PrimaryKey ]) {
90+ $value = $DeploymentOutputs .$PrimaryKey.value
91+ }
92+
93+ # If primary key failed, try fallback key
94+ if (-not $value -and $DeploymentOutputs.PSObject.Properties [$FallbackKey ]) {
95+ $value = $DeploymentOutputs .$FallbackKey.value
96+ }
97+
98+ return $value
99+ }
100+
79101function Get-ValuesFromAzDeployment {
80102 Write-Host " Getting values from Azure deployment outputs..."
81103
@@ -95,30 +117,29 @@ function Get-ValuesFromAzDeployment {
95117 return $false
96118 }
97119
98- # Extract specific outputs
99- $script :storageAccount = $deploymentOutputs.azurE_STORAGE_ACCOUNT_NAME.value
100- # $script:blobContainer = $deploymentOutputs.azurE_STORAGE_CONTAINER_NAME.value
101- $script :blobContainerForRetailCustomer = $deploymentOutputs.azurE_STORAGE_CONTAINER_NAME_RETAIL_CUSTOMER.value
102- $script :blobContainerForRetailOrder = $deploymentOutputs.azurE_STORAGE_CONTAINER_NAME_RETAIL_ORDER.value
103- $script :blobContainerForRFPSummary = $deploymentOutputs.azurE_STORAGE_CONTAINER_NAME_RFP_SUMMARY.value
104- $script :blobContainerForRFPRisk = $deploymentOutputs.azurE_STORAGE_CONTAINER_NAME_RFP_RISK.value
105- $script :blobContainerForRFPCompliance = $deploymentOutputs.azurE_STORAGE_CONTAINER_NAME_RFP_COMPLIANCE.value
106- $script :blobContainerForContractSummary = $deploymentOutputs.azurE_STORAGE_CONTAINER_NAME_CONTRACT_SUMMARY.value
107- $script :blobContainerForContractRisk = $deploymentOutputs.azurE_STORAGE_CONTAINER_NAME_CONTRACT_RISK.value
108- $script :blobContainerForContractCompliance = $deploymentOutputs.azurE_STORAGE_CONTAINER_NAME_CONTRACT_COMPLIANCE.value
109- $script :aiSearchIndexForRetailCustomer = $deploymentOutputs.azurE_AI_SEARCH_INDEX_NAME_RETAIL_CUSTOMER.value
110- $script :aiSearchIndexForRetailOrder = $deploymentOutputs.azurE_AI_SEARCH_INDEX_NAME_RETAIL_ORDER.value
111- $script :aiSearchIndexForRFPSummary = $deploymentOutputs.azurE_AI_SEARCH_INDEX_NAME_RFP_SUMMARY.value
112- $script :aiSearchIndexForRFPRisk = $deploymentOutputs.azurE_AI_SEARCH_INDEX_NAME_RFP_RISK.value
113- $script :aiSearchIndexForRFPCompliance = $deploymentOutputs.azurE_AI_SEARCH_INDEX_NAME_RFP_COMPLIANCE.value
114- $script :aiSearchIndexForContractSummary = $deploymentOutputs.azurE_AI_SEARCH_INDEX_NAME_CONTRACT_SUMMARY.value
115- $script :aiSearchIndexForContractRisk = $deploymentOutputs.azurE_AI_SEARCH_INDEX_NAME_CONTRACT_RISK.value
116- $script :aiSearchIndexForContractCompliance = $deploymentOutputs.azurE_AI_SEARCH_INDEX_NAME_CONTRACT_COMPLIANCE.value
117- $script :aiSearch = $deploymentOutputs.azurE_AI_SEARCH_NAME.value
118- $script :backendUrl = $deploymentOutputs.backenD_URL.value
120+ # Extract specific outputs with fallback logic
121+ $script :storageAccount = Get-DeploymentValue - DeploymentOutputs $deploymentOutputs - PrimaryKey " azurE_STORAGE_ACCOUNT_NAME" - FallbackKey " azureStorageAccountName"
122+ $script :blobContainerForRetailCustomer = Get-DeploymentValue - DeploymentOutputs $deploymentOutputs - PrimaryKey " azurE_STORAGE_CONTAINER_NAME_RETAIL_CUSTOMER" - FallbackKey " azureStorageContainerNameRetailCustomer"
123+ $script :blobContainerForRetailOrder = Get-DeploymentValue - DeploymentOutputs $deploymentOutputs - PrimaryKey " azurE_STORAGE_CONTAINER_NAME_RETAIL_ORDER" - FallbackKey " azureStorageContainerNameRetailOrder"
124+ $script :blobContainerForRFPSummary = Get-DeploymentValue - DeploymentOutputs $deploymentOutputs - PrimaryKey " azurE_STORAGE_CONTAINER_NAME_RFP_SUMMARY" - FallbackKey " azureStorageContainerNameRfpSummary"
125+ $script :blobContainerForRFPRisk = Get-DeploymentValue - DeploymentOutputs $deploymentOutputs - PrimaryKey " azurE_STORAGE_CONTAINER_NAME_RFP_RISK" - FallbackKey " azureStorageContainerNameRfpRisk"
126+ $script :blobContainerForRFPCompliance = Get-DeploymentValue - DeploymentOutputs $deploymentOutputs - PrimaryKey " azurE_STORAGE_CONTAINER_NAME_RFP_COMPLIANCE" - FallbackKey " azureStorageContainerNameRfpCompliance"
127+ $script :blobContainerForContractSummary = Get-DeploymentValue - DeploymentOutputs $deploymentOutputs - PrimaryKey " azurE_STORAGE_CONTAINER_NAME_CONTRACT_SUMMARY" - FallbackKey " azureStorageContainerNameContractSummary"
128+ $script :blobContainerForContractRisk = Get-DeploymentValue - DeploymentOutputs $deploymentOutputs - PrimaryKey " azurE_STORAGE_CONTAINER_NAME_CONTRACT_RISK" - FallbackKey " azureStorageContainerNameContractRisk"
129+ $script :blobContainerForContractCompliance = Get-DeploymentValue - DeploymentOutputs $deploymentOutputs - PrimaryKey " azurE_STORAGE_CONTAINER_NAME_CONTRACT_COMPLIANCE" - FallbackKey " azureStorageContainerNameContractCompliance"
130+ $script :aiSearchIndexForRetailCustomer = Get-DeploymentValue - DeploymentOutputs $deploymentOutputs - PrimaryKey " azurE_AI_SEARCH_INDEX_NAME_RETAIL_CUSTOMER" - FallbackKey " azureAiSearchIndexNameRetailCustomer"
131+ $script :aiSearchIndexForRetailOrder = Get-DeploymentValue - DeploymentOutputs $deploymentOutputs - PrimaryKey " azurE_AI_SEARCH_INDEX_NAME_RETAIL_ORDER" - FallbackKey " azureAiSearchIndexNameRetailOrder"
132+ $script :aiSearchIndexForRFPSummary = Get-DeploymentValue - DeploymentOutputs $deploymentOutputs - PrimaryKey " azurE_AI_SEARCH_INDEX_NAME_RFP_SUMMARY" - FallbackKey " azureAiSearchIndexNameRfpSummary"
133+ $script :aiSearchIndexForRFPRisk = Get-DeploymentValue - DeploymentOutputs $deploymentOutputs - PrimaryKey " azurE_AI_SEARCH_INDEX_NAME_RFP_RISK" - FallbackKey " azureAiSearchIndexNameRfpRisk"
134+ $script :aiSearchIndexForRFPCompliance = Get-DeploymentValue - DeploymentOutputs $deploymentOutputs - PrimaryKey " azurE_AI_SEARCH_INDEX_NAME_RFP_COMPLIANCE" - FallbackKey " azureAiSearchIndexNameRfpCompliance"
135+ $script :aiSearchIndexForContractSummary = Get-DeploymentValue - DeploymentOutputs $deploymentOutputs - PrimaryKey " azurE_AI_SEARCH_INDEX_NAME_CONTRACT_SUMMARY" - FallbackKey " azureAiSearchIndexNameContractSummary"
136+ $script :aiSearchIndexForContractRisk = Get-DeploymentValue - DeploymentOutputs $deploymentOutputs - PrimaryKey " azurE_AI_SEARCH_INDEX_NAME_CONTRACT_RISK" - FallbackKey " azureAiSearchIndexNameContractRisk"
137+ $script :aiSearchIndexForContractCompliance = Get-DeploymentValue - DeploymentOutputs $deploymentOutputs - PrimaryKey " azurE_AI_SEARCH_INDEX_NAME_CONTRACT_COMPLIANCE" - FallbackKey " azureAiSearchIndexNameContractCompliance"
138+ $script :aiSearch = Get-DeploymentValue - DeploymentOutputs $deploymentOutputs - PrimaryKey " azurE_AI_SEARCH_NAME" - FallbackKey " azureAiSearchName"
139+ $script :backendUrl = Get-DeploymentValue - DeploymentOutputs $deploymentOutputs - PrimaryKey " backenD_URL" - FallbackKey " backendUrl"
119140
120141 # Validate that we extracted all required values
121- if (-not $script :storageAccount -or -not $script :blobContainer -or -not $ script : aiSearch -or -not $ script :aiSearchIndex -or -not $script :backendUrl ) {
142+ if (-not $script :storageAccount -or -not $script :aiSearch -or -not $script :backendUrl ) {
122143 Write-Host " Error: Could not extract all required values from deployment outputs."
123144 return $false
124145 }
0 commit comments