Skip to content

Commit cd879f3

Browse files
Update AKS managed identity retrieval with error handling and clarify model name comments
1 parent 406c2c9 commit cd879f3

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

Deployment/resourcedeployment.ps1

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ class DeploymentResult {
483483
$this.AzCosmosDBName = "cosmos-$solutionSuffix"
484484
$this.AzAppConfigName = "appcs-$solutionSuffix"
485485

486-
# Model names from bicep defaults
486+
# Model names from bicep defaults (if changed in bicep, this needs to be updated here as well)
487487
$this.AzGPT4oModelName = "gpt-4.1-mini"
488488
$this.AzGPT4oModelId = "gpt-4.1-mini"
489489
$this.AzGPTEmbeddingModelName = "text-embedding-3-large"
@@ -496,7 +496,14 @@ class DeploymentResult {
496496
$this.AzAppConfigEndpoint = "https://$($this.AzAppConfigName).azconfig.io"
497497

498498
# Get AKS managed identity
499-
$this.AksMid = az aks show --name $this.AksName --resource-group $resourceGroupName --query "identity.principalId" -o tsv 2>$null
499+
$aksMid = az aks show --name $this.AksName --resource-group $resourceGroupName --query "identity.principalId" -o tsv 2>$null
500+
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($aksMid)) {
501+
Write-Host "Warning: Failed to retrieve AKS managed identity for '$($this.AksName)' in resource group '$resourceGroupName'.`n`tThe AKS cluster may not exist or you may not have sufficient permissions." -ForegroundColor Yellow
502+
$this.AksMid = $null
503+
}
504+
else {
505+
$this.AksMid = $aksMid
506+
}
500507

501508
Write-Host "Successfully reconstructed resource names from SolutionSuffix '$solutionSuffix'" -ForegroundColor Green
502509
}

0 commit comments

Comments
 (0)