@@ -353,59 +353,85 @@ class DeploymentResult {
353353 Write-Error " Deployment name not found in the resource group tags."
354354 exit 1
355355 }
356-
356+
357357 $deploymentOutputs = $ (az deployment group show -- resource- group " $resourceGroupName " -- name " $deploymentName " -- query " properties.outputs" - o json | ConvertFrom-Json )
358-
359- $this.TenantId = $deploymentOutputs.azurE_TENANT_ID.value
358+
359+ # Helper function to get value from deployment outputs with fallback
360+ function Get-DeploymentOutputValue {
361+ param (
362+ [Parameter (Mandatory = $true )]
363+ $outputs ,
364+ [Parameter (Mandatory = $true )]
365+ [string ]$primaryKey ,
366+ [Parameter (Mandatory = $true )]
367+ [string ]$fallbackKey
368+ )
369+
370+ $value = $null
371+
372+ # Try primary key first (old convention)
373+ if ($outputs.PSObject.Properties.Name -contains $primaryKey ) {
374+ $value = $outputs .$primaryKey.value
375+ }
376+
377+ # If not found or empty, try fallback key (new convention)
378+ if ([string ]::IsNullOrEmpty($value ) -and ($outputs.PSObject.Properties.Name -contains $fallbackKey )) {
379+ $value = $outputs .$fallbackKey.value
380+ }
381+
382+ return $value
383+ }
384+
385+ # Tenant ID
386+ $this.TenantId = Get-DeploymentOutputValue - outputs $deploymentOutputs - primaryKey " azurE_TENANT_ID" - fallbackKey " azureTenantId"
360387 if (! $this.TenantId ) {
361388 $this.TenantId = $ (az account show -- query tenantId - o tsv)
362389 }
363-
364- $this.SubscriptionId = $ (az account show -- query id - o tsv)
365-
390+
391+ $this.SubscriptionId = $ (az account show -- query id - o tsv)
392+
366393 # Resource Group
367- $this.ResourceGroupName = $resourceGroupName
368- $this.ResourceGroupId = $deploymentOutputs .azurE_RESOURCE_GROUP_ID.value
394+ $this.ResourceGroupName = $resourceGroupName
395+ $this.ResourceGroupId = Get-DeploymentOutputValue - outputs $deploymentOutputs - primaryKey " azurE_RESOURCE_GROUP_ID " - fallbackKey " azureResourceGroupId "
369396 if (! $this.ResourceGroupId ) {
370- Write-Error " Required value 'AZURE_RESOURCE_GROUP_ID' not found in the deployment outputs."
397+ Write-Error " Required value 'AZURE_RESOURCE_GROUP_ID' or 'azureResourceGroupId' not found in the deployment outputs."
371398 exit 1
372399 }
373-
400+
374401 # Storage Account
375- $this.StorageAccountName = $deploymentOutputs. storagE_ACCOUNT_NAME.value
376-
402+ $this.StorageAccountName = Get-DeploymentOutputValue - outputs $deploymentOutputs - primaryKey " storagE_ACCOUNT_NAME" - fallbackKey " storageAccountName "
403+
377404 # Search Service
378- $this.AzSearchServiceName = $deploymentOutputs. azurE_SEARCH_SERVICE_NAME.value
379- $this.AzSearchServicEndpoint = " https://$ ( $this.AzSearchServiceName ) .search.windows.net"
380-
405+ $this.AzSearchServiceName = Get-DeploymentOutputValue - outputs $deploymentOutputs - primaryKey " azurE_SEARCH_SERVICE_NAME" - fallbackKey " azureSearchServiceName "
406+ $this.AzSearchServicEndpoint = " https://$ ( $this.AzSearchServiceName ) .search.windows.net"
407+
381408 # AKS
382- $this.AksName = $deploymentOutputs .azurE_AKS_NAME.value
383- $this.AksMid = $deploymentOutputs .azurE_AKS_MI_ID.value
384-
409+ $this.AksName = Get-DeploymentOutputValue - outputs $deploymentOutputs - primaryKey " azurE_AKS_NAME " - fallbackKey " azureAksName "
410+ $this.AksMid = Get-DeploymentOutputValue - outputs $deploymentOutputs - primaryKey " azurE_AKS_MI_ID " - fallbackKey " azureAksMiId "
411+
385412 # Container Registry
386- $this.AzContainerRegistryName = $deploymentOutputs. azurE_CONTAINER_REGISTRY_NAME.value
387-
413+ $this.AzContainerRegistryName = Get-DeploymentOutputValue - outputs $deploymentOutputs - primaryKey " azurE_CONTAINER_REGISTRY_NAME" - fallbackKey " azureContainerRegistryName "
414+
388415 # Cognitive Service - Azure AI Document Intelligence Service
389- $this.AzCognitiveServiceName = $deploymentOutputs. azurE_COGNITIVE_SERVICE_NAME.value
390- $this.AzCognitiveServiceEndpoint = $deploymentOutputs. azurE_COGNITIVE_SERVICE_ENDPOINT.value
391-
416+ $this.AzCognitiveServiceName = Get-DeploymentOutputValue - outputs $deploymentOutputs - primaryKey " azurE_COGNITIVE_SERVICE_NAME" - fallbackKey " azureCognitiveServiceName "
417+ $this.AzCognitiveServiceEndpoint = Get-DeploymentOutputValue - outputs $deploymentOutputs - primaryKey " azurE_COGNITIVE_SERVICE_ENDPOINT" - fallbackKey " azureCognitiveServiceEndpoint "
418+
392419 # Open AI Service
393- $this.AzOpenAiServiceName = $deploymentOutputs. azurE_OPENAI_SERVICE_NAME.value
394- $this.AzOpenAiServiceEndpoint = $deploymentOutputs. azurE_OPENAI_SERVICE_ENDPOINT.value
395-
420+ $this.AzOpenAiServiceName = Get-DeploymentOutputValue - outputs $deploymentOutputs - primaryKey " azurE_OPENAI_SERVICE_NAME" - fallbackKey " azureOpenAiServiceName "
421+ $this.AzOpenAiServiceEndpoint = Get-DeploymentOutputValue - outputs $deploymentOutputs - primaryKey " azurE_OPENAI_SERVICE_ENDPOINT" - fallbackKey " azureOpenAiServiceEndpoint "
422+
396423 # Cosmos DB
397- $this.AzCosmosDBName = $deploymentOutputs .azurE_COSMOSDB_NAME.value
398-
424+ $this.AzCosmosDBName = Get-DeploymentOutputValue - outputs $deploymentOutputs - primaryKey " azurE_COSMOSDB_NAME " - fallbackKey " azureCosmosDbName "
425+
399426 # Open AI Service Models
400- $this.AzGPT4oModelName = $deploymentOutputs .aZ_GPT4O_MODEL_NAME.value
401- $this.AzGPT4oModelId = $deploymentOutputs .aZ_GPT4O_MODEL_ID.value
402- $this.AzGPTEmbeddingModelName = $deploymentOutputs. aZ_GPT_EMBEDDING_MODEL_NAME.value
403- $this.AzGPTEmbeddingModelId = $deploymentOutputs. aZ_GPT_EMBEDDING_MODEL_ID.value
404-
427+ $this.AzGPT4oModelName = Get-DeploymentOutputValue - outputs $deploymentOutputs - primaryKey " aZ_GPT4O_MODEL_NAME " - fallbackKey " azGpt4oModelName "
428+ $this.AzGPT4oModelId = Get-DeploymentOutputValue - outputs $deploymentOutputs - primaryKey " aZ_GPT4O_MODEL_ID " - fallbackKey " azGpt4oModelId "
429+ $this.AzGPTEmbeddingModelName = Get-DeploymentOutputValue - outputs $deploymentOutputs - primaryKey " aZ_GPT_EMBEDDING_MODEL_NAME" - fallbackKey " azGptEmbeddingModelName "
430+ $this.AzGPTEmbeddingModelId = Get-DeploymentOutputValue - outputs $deploymentOutputs - primaryKey " aZ_GPT_EMBEDDING_MODEL_ID" - fallbackKey " azGptEmbeddingModelId "
431+
405432 # App Configuration
406- $this.AzAppConfigEndpoint = $deploymentOutputs.azurE_APP_CONFIG_ENDPOINT.value
407- $this.AzAppConfigName = $deploymentOutputs.azurE_APP_CONFIG_NAME.value
408-
433+ $this.AzAppConfigEndpoint = Get-DeploymentOutputValue - outputs $deploymentOutputs - primaryKey " azurE_APP_CONFIG_ENDPOINT" - fallbackKey " azureAppConfigEndpoint"
434+ $this.AzAppConfigName = Get-DeploymentOutputValue - outputs $deploymentOutputs - primaryKey " azurE_APP_CONFIG_NAME" - fallbackKey " azureAppConfigName"
409435 }
410436}
411437
0 commit comments