@@ -176,6 +176,7 @@ function DeployAzureResources([string]$location, [string]$modelLocation) {
176176 if ($LASTEXITCODE -ne 0 ) {
177177 Write-Host " There might be something wrong with your deployment." - ForegroundColor Red
178178 Write-Host $whatIfResult - ForegroundColor Red
179+ failureBanner
179180 exit 1
180181 }
181182 # Proceed with the actual deployment
@@ -185,6 +186,7 @@ function DeployAzureResources([string]$location, [string]$modelLocation) {
185186 if ($LASTEXITCODE -ne 0 ) {
186187 Write-Host " Deployment failed. Stopping execution." - ForegroundColor Red
187188 Write-Host $deploymentResult - ForegroundColor Red
189+ failureBanner
188190 exit 1
189191 }
190192
@@ -197,6 +199,7 @@ function DeployAzureResources([string]$location, [string]$modelLocation) {
197199 Write-Host $_.Exception.Message - ForegroundColor Red
198200 Write-Host $_.InvocationInfo.PositionMessage - ForegroundColor Red
199201 Write-Host $_.ScriptStackTrace - ForegroundColor Red
202+ failureBanner
200203 exit 1
201204 }
202205}
@@ -410,6 +413,7 @@ function Check-Docker {
410413# Check if Docker is running before proceeding
411414if (-not (Check- Docker)) {
412415 Write-Host " Docker is not running. Please start Docker and try again." - ForegroundColor Red
416+ failureBanner
413417 exit 1
414418}
415419
@@ -439,6 +443,9 @@ try {
439443 # Step 2 : Get Secrets from Azure resources
440444 Show-Banner - Title " Step 2 : Get Secrets from Azure resources"
441445 # ##############################################################
446+ # Validate if the Storage Account Name is empty or null
447+ ValidateVariableIsNullOrEmpty - variableValue $deploymentResult.StorageAccountName - variableName " Storage Account Name"
448+
442449 # Get the storage account key
443450 $storageAccountKey = az storage account keys list -- account- name $deploymentResult.StorageAccountName -- resource- group $deploymentResult.ResourceGroupName -- query " [0].value" - o tsv
444451
@@ -596,6 +603,7 @@ try {
596603
597604 if ($retryCount -eq $maxRetries ) {
598605 Write-Host " Max retries reached. Failed to update the AKS cluster." - ForegroundColor Red
606+ failureBanner
599607 exit 1
600608 }
601609
@@ -615,6 +623,7 @@ try {
615623 Write-Host " Error details:" - ForegroundColor Red
616624 Write-Host $_.Exception.Message - ForegroundColor Red
617625 Write-Host $_.Exception.StackTrace - ForegroundColor Red
626+ failureBanner
618627 exit 1
619628 }
620629
@@ -630,6 +639,7 @@ try {
630639 Write-Host " Error details:" - ForegroundColor Red
631640 Write-Host $_.Exception.Message - ForegroundColor Red
632641 Write-Host $_.Exception.StackTrace - ForegroundColor Red
642+ failureBanner
633643 exit 1
634644 }
635645
@@ -650,6 +660,7 @@ try {
650660 Write-Host " Error details:" - ForegroundColor Red
651661 Write-Host $_.Exception.Message - ForegroundColor Red
652662 Write-Host $_.Exception.StackTrace - ForegroundColor Red
663+ failureBanner
653664 exit 1
654665 }
655666
@@ -716,6 +727,9 @@ try {
716727 # Validate if System Assigned Identity is null or empty
717728 ValidateVariableIsNullOrEmpty - variableValue $systemAssignedIdentity - variableName " System-assigned managed identity"
718729
730+ # Validate if ResourceGroupId is null or empty
731+ ValidateVariableIsNullOrEmpty - variableValue $deploymentResult.ResourceGroupId - variableName " ResourceGroupId"
732+
719733 # Assign the role for aks system assigned managed identity to App Configuration Data Reader role with the scope of Resourcegroup
720734 az role assignment create -- assignee $systemAssignedIdentity -- role " App Configuration Data Reader" -- scope $deploymentResult.ResourceGroupId
721735
@@ -743,6 +757,7 @@ try {
743757 Write-Host " Error details:" - ForegroundColor Red
744758 Write-Host $_.Exception.Message - ForegroundColor Red
745759 Write-Host $_.Exception.StackTrace - ForegroundColor Red
760+ failureBanner
746761 exit 1
747762 }
748763
@@ -772,6 +787,9 @@ try {
772787
773788
774789 # 5.3 Update deploy.deployment.yaml.template file and save as deploy.deployment.yaml
790+ # Validate AzContainerRegistryName IsNull Or Empty.
791+ ValidateVariableIsNullOrEmpty - variableValue $deploymentResult.AzContainerRegistryName - variableName " Azure Container Registry Name"
792+
775793 # # Define Image Tags
776794 $acrNamespace = " kmgs"
777795 $acrAIServiceTag = " $ ( $deploymentResult.AzContainerRegistryName ) .azurecr.io/$acrNamespace /aiservice"
@@ -821,8 +839,9 @@ try {
821839
822840
823841# ======================================================================================================================================================================
842+ # Validate AzAppConfigEndpoint IsNull Or Empty.
843+ ValidateVariableIsNullOrEmpty - variableValue $deploymentResult.AzAppConfigEndpoint - variableName " Azure App Configuration Endpoint"
824844 # App Deployment after finishing the AKS infrastructure setup
825-
826845 $appConfigServicePlaceholders = @ {
827846 ' {{ appconfig-url }}' = $deploymentResult.AzAppConfigEndpoint
828847 }
0 commit comments