From 840303e9c6e7067794d5a5075845f23807b2587e Mon Sep 17 00:00:00 2001 From: Gary Blake Date: Thu, 20 Jun 2024 08:50:50 +0100 Subject: [PATCH] fix: wsa deployment error - Fixed `Export-WsaJsonSpec` cmdlet where the cluster IP was being used for the database IP. - Fixed `Invoke-UndoGlobalWsaDeployment` cmdlet where incorrect message output was being displayed. - Enhanced `Export-GlobalWsaJsonSpec` cmdlet to include the export from Planning and Preparations Workbook the Workspace ONE Access database IP. Signed-off-by: Gary Blake --- CHANGELOG.md | 8 + PowerValidatedSolutions.psd1 | 4 +- PowerValidatedSolutions.psm1 | 322 +++++++++++++++++++---------------- 3 files changed, 183 insertions(+), 151 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b366ec8d..9d0a9ffa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Release History +## v2.10.2 + +> Release Date: 2024-06-20 + +- Fixed `Export-WsaJsonSpec` cmdlet where the cluster IP was being used for the database IP. +- Fixed `Invoke-UndoGlobalWsaDeployment` cmdlet where incorrect message output was being displayed. +- Enhanced `Export-GlobalWsaJsonSpec` cmdlet to include the export from Planning and Preparations Workbook the Workspace ONE Access database IP. + ## v2.10.1 > Release Date: 2024-06-14 diff --git a/PowerValidatedSolutions.psd1 b/PowerValidatedSolutions.psd1 index a9d971f2..637849e7 100644 --- a/PowerValidatedSolutions.psd1 +++ b/PowerValidatedSolutions.psd1 @@ -3,7 +3,7 @@ # Module manifest for module 'PowerValidatedSolutions' # Generated by: Broadcom -# Generated on: 2024-06-14 +# Generated on: 2024-06-20 @{ @@ -11,7 +11,7 @@ RootModule = 'PowerValidatedSolutions.psm1' # Version number of this module. - ModuleVersion = '2.10.1.1001' + ModuleVersion = '2.10.2.1001' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/PowerValidatedSolutions.psm1 b/PowerValidatedSolutions.psm1 index 43ddd786..9086c1b5 100644 --- a/PowerValidatedSolutions.psm1 +++ b/PowerValidatedSolutions.psm1 @@ -27385,7 +27385,6 @@ Function Export-GlobalWsaJsonSpec { 'antiAffinityRuleName' = "anti-affinity-rule-wsa" # $pnpWorkbook.Workbook.Names["xreg_wsa_anti_affinity_rule"].Value 'drsGroupNameWsa' = $pnpWorkbook.Workbook.Names["xreg_wsa_vm_group_name"].Value 'stretchedCluster' = $pnpWorkbook.Workbook.Names["mgmt_stretched_cluster_chosen"].Value - 'drsVmGroupNameAz' = $pnpWorkbook.Workbook.Names["mgmt_az1_vm_group_name"].Value 'ntpServer' = $pnpWorkbook.Workbook.Names["xregion_ntp1_server"].Value 'domainFqdn' = $pnpWorkbook.Workbook.Names["region_ad_child_fqdn"].Value 'domainBindDn' = $pnpWorkbook.Workbook.Names["child_ad_bind_dn"].Value @@ -27402,7 +27401,8 @@ Function Export-GlobalWsaJsonSpec { 'aslcmReleaseManagersGroup' = $pnpWorkbook.Workbook.Names["group_gg_vrslcm_release_managers"].Value + "@" + $pnpWorkbook.Workbook.Names["region_ad_child_fqdn"].Value 'aslcmContentDevelopersGroup' = $pnpWorkbook.Workbook.Names["group_gg_vrslcm_content_developers"].Value + "@" + $pnpWorkbook.Workbook.Names["region_ad_child_fqdn"].Value 'clusterFqdn' = $pnpWorkbook.Workbook.Names["xreg_wsa_virtual_fqdn"].Value - 'clusterIp' = $pnpWorkbook.Workbook.Names["xreg_wsa_delegate_ip"].Value + 'clusterIp' = $pnpWorkbook.Workbook.Names["xreg_wsa_virtual_ip"].Value + 'databaseIp' = $pnpWorkbook.Workbook.Names["xreg_wsa_delegate_ip"].Value 'vmNameNodeA' = $pnpWorkbook.Workbook.Names["xreg_wsa_nodea_hostname"].Value 'hostNameNodeA' = $pnpWorkbook.Workbook.Names["xreg_wsa_nodea_fqdn"].Value 'ipNodeA' = $pnpWorkbook.Workbook.Names["xreg_wsa_nodea_ip"].Value @@ -27426,6 +27426,10 @@ Function Export-GlobalWsaJsonSpec { 'caUsername' = $pnpWorkbook.Workbook.Names["user_svc_vcf_ca_vcf"].Value 'caUserPassword' = $pnpWorkbook.Workbook.Names["svc_vcf_ca_vvd_password"].Value } + + if ($pnpWorkbook.Workbook.Names["mgmt_stretched_cluster_chosen"].Value -eq "Include") { + $jsonObject | Add-Member -notepropertyname 'drsVmGroupNameAz' -notepropertyvalue $pnpWorkbook.Workbook.Names["mgmt_az1_vm_group_name"].Value + } Close-ExcelPackage $pnpWorkbook -NoSave -ErrorAction SilentlyContinue $jsonObject | ConvertTo-Json -Depth 12 | Out-File -Encoding UTF8 -FilePath $jsonFile $jsonInput = (Get-Content -Path $jsonFile) | ConvertFrom-Json @@ -27872,7 +27876,18 @@ Function Invoke-UndoGlobalWsaDeployment { if (!$failureDetected) { Show-PowerValidatedSolutionsOutput -message "Remove Roles for Active Directory Groups in $lcmProductName" - Show-PowerValidatedSolutionsOutput -type NOTE -message "AUTOMATION TO BE ADDED" + $vrslcmAdminRole = "LCM Admin" + $vrslcmReleaseManagerRole = "Content Release Manager" + $vrslcmContentDeveloperRole = "Content Developer" + Show-PowerValidatedSolutionsOutput -message "Attempting to Remove the ($vrslcmAdminRole) Role from ($($jsonInput.aslcmAdminGroup))" + $StatusMsg = Undo-vRSLCMGroupRole -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -group $jsonInput.aslcmAdminGroup -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + messageHandler -statusMessage $StatusMsg -warningMessage $WarnMsg -errorMessage $ErrorMsg; if ($ErrorMsg) { $failureDetected = $true } + Show-PowerValidatedSolutionsOutput -message "Attempting to Remove the ($vrslcmReleaseManagerRole) Role from ($($jsonInput.aslcmReleaseManagersGroup))" + $StatusMsg = Undo-vRSLCMGroupRole -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -group $jsonInput.aslcmReleaseManagersGroup -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + messageHandler -statusMessage $StatusMsg -warningMessage $WarnMsg -errorMessage $ErrorMsg; if ($ErrorMsg) { $failureDetected = $true } + Show-PowerValidatedSolutionsOutput -message "Attempting to Remove the ($vrslcmContentDeveloperRole) Role from ($($jsonInput.aslcmContentDevelopersGroup))" + $StatusMsg = Undo-vRSLCMGroupRole -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -group $jsonInput.aslcmContentDevelopersGroup -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + messageHandler -statusMessage $StatusMsg -warningMessage $WarnMsg -errorMessage $ErrorMsg; if ($ErrorMsg) { $failureDetected = $true } } if (!$failureDetected) { @@ -27894,7 +27909,7 @@ Function Invoke-UndoGlobalWsaDeployment { } } Disconnect-VIServer $vcfVcenterDetails.fqdn -Confirm:$false -WarningAction SilentlyContinue - Show-PowerValidatedSolutionsOutput -message "Deleting $automationProductName from $lcmProductName" + Show-PowerValidatedSolutionsOutput -message "Deleting $lcmProductName from $lcmProductName" $StatusMsg = Undo-WsaDeployment -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -environmentName $jsonInput.environmentName -monitor -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg if ($StatusMsg) { Show-PowerValidatedSolutionsOutput -message $StatusMsg } elseif ($WarnMsg) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg } elseif ($ErrorMsg) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } } @@ -28010,179 +28025,188 @@ Function Export-WsaJsonSpec { if ($defaultPassword = Get-vRSLCMLockerPassword -alias $jsonInput.globalPasswordAlias) { if ($configAdminPassword = Get-vRSLCMLockerPassword -alias $jsonInput.configAdminPasswordAlias) { if ($wsaPassword = Get-vRSLCMLockerPassword -alias $jsonInput.adminPasswordAlias) { - if ($vcfVersion -ge "4.5.0") { - $vcCredentials = Get-vRSLCMLockerPassword | Where-Object { $_.userName -match (($jsonInput.vcFqdn).Split(".")[0] + "@vsphere.local") } - } else { - $vcCredentials = Get-vRSLCMLockerPassword -alias (($jsonInput.vcFqdn).Split(".")[0] + "-" + $jsonInput.vcDatacenter) - } - if ($datacenterName = Get-vRSLCMDatacenter | Where-Object { $_.dataCenterName -eq $jsonInput.xintDatacenter }) { - $xintEnvironment = Get-vRSLCMEnvironment | Where-Object { $_.environmentName -eq $jsonInput.environmentName } - - #### Generate the Workspace ONE Properties Section - if (!$PsBoundParameters.ContainsKey("customVersion")) { - $actualVcfVersion = ((Get-VCFManager).version -Split ('\.\d{1}\-\d{8}')) -split '\s+' -match '\S' - foreach ($vcfVersion in $moduleConfig.vcfVersion) { - if ($vcfVersion.$actualVcfVersion) { - $wsaVersion = ($vcfVersion.$actualVcfVersion | Where-Object { $_.AriaComponent -eq "WorkspaceONE" }).Version - } - } + if ($wsaRootPassword = Get-vRSLCMLockerPassword -alias $jsonInput.rootPasswordAlias) { + if ($vcfVersion -ge "4.5.0") { + $vcCredentials = Get-vRSLCMLockerPassword | Where-Object { $_.userName -match (($jsonInput.vcFqdn).Split(".")[0] + "@vsphere.local") } } else { - $wsaVersion = $customVersion + $vcCredentials = Get-vRSLCMLockerPassword -alias (($jsonInput.vcFqdn).Split(".")[0] + "-" + $jsonInput.vcDatacenter) } - - $infrastructurePropertiesObject = @() - $infrastructurePropertiesObject += [pscustomobject]@{ - 'acceptEULA' = "true" - 'enableTelemetry' = "true" - 'regionName' = "default" - 'zoneName' = "default" - 'dataCenterVmid' = $datacenterName.dataCenterVmid - 'vCenterName' = ($jsonInput.vcFqdn).Split(".")[0] - 'vCenterHost' = $jsonInput.vcFqdn - 'vcUsername' = $vcCredentials.userName - 'vcPassword' = ("locker:password:" + $($vcCredentials.vmid) + ":" + $($vcCredentials.alias)) - 'defaultPassword' = ("locker:password:" + $($defaultPassword.vmid) + ":" + $($defaultPassword.alias)) - 'certificate' = ("locker:certificate:" + $($wsaCertificate.vmid) + ":" + $($wsaCertificate.alias)) - 'cluster' = ($jsonInput.vcDatacenter + "#" + $jsonInput.vcCluster) - 'storage' = $jsonInput.vcDatastore - 'diskMode' = "thin" - 'network' = $jsonInput.xintNetwork - 'masterVidmEnabled' = "false" - 'dns' = $jsonInput.xintNetworkDns - 'domain' = $jsonInput.xintNetworkDomain - 'gateway' = $jsonInput.xintNetworkGateway - 'netmask' = $jsonInput.xintNetworkMask - 'searchpath' = $jsonInput.xintNetworkSearch - 'timeSyncMode' = "ntp" - 'ntp' = $jsonInput.xintNetworkNtp - 'vcfProperties' = '{"vcfEnabled":true,"sddcManagerDetails":[{"sddcManagerHostName":"' + $jsonInput.sddcManagerFqdn + '","sddcManagerName":"default","sddcManagerVmid":"default"}]}' - } - - $infrastructureObject = @() - $infrastructureObject += [pscustomobject]@{ - 'properties' = ($infrastructurePropertiesObject | Select-Object -Skip 0) - } - - ### Generate the Properties Details - if ($PsBoundParameters.ContainsKey("useContentLibrary")) { - $contentLibraryItems = ((Get-vRSLCMDatacenterVcenter -datacenterVmid $datacenterName.dataCenterVmid -vcenterName ($jsonInput.vcFqdn).Split(".")[0]).contentLibraries | Where-Object { $_.contentLibraryName -eq $jsonInput.contentLibraryName }).contentLibraryItems - if ($contentLibraryItems) { - $contentLibraryItemId = ($contentLibraryItems | Where-Object { $_.contentLibraryItemName -match "identity-manager-$wsaVersion" }).contentLibraryItemId + if ($datacenterName = Get-vRSLCMDatacenter | Where-Object { $_.dataCenterName -eq $jsonInput.xintDatacenter }) { + $xintEnvironment = Get-vRSLCMEnvironment | Where-Object { $_.environmentName -eq $jsonInput.environmentName } + + #### Generate the Workspace ONE Properties Section + if (!$PsBoundParameters.ContainsKey("customVersion")) { + $actualVcfVersion = ((Get-VCFManager).version -Split ('\.\d{1}\-\d{8}')) -split '\s+' -match '\S' + foreach ($vcfVersion in $moduleConfig.vcfVersion) { + if ($vcfVersion.$actualVcfVersion) { + $wsaVersion = ($vcfVersion.$actualVcfVersion | Where-Object { $_.AriaComponent -eq "WorkspaceONE" }).Version + } + } } else { - Write-Error "Unable to find vSphere Content Library ($($jsonInput.contentLibraryName)) or Content Library Item in VMware Aria Suite Lifecycle: PRE_VALIDATION_FAILED" - Break + $wsaVersion = $customVersion } - } - $productPropertiesObject = @() - $productPropertiesObject += [pscustomobject]@{ - 'vidmAdminPassword' = ("locker:password:" + $($wsaPassword.vmid) + ":" + $($wsaPassword.alias)) - 'syncGroupMembers' = $true - 'nodeSize' = ($jsonInput.wsaNodeSize).ToLower() - 'defaultConfigurationEmail' = $jsonInput.configAdminUserEmail - 'defaultConfigurationUsername' = $jsonInput.configAdminUserName - 'defaultConfigurationPassword' = ("locker:password:" + $($configAdminPassword.vmid) + ":" + $($configAdminPassword.alias)) - 'defaultTenantAlias' = "" - 'vidmDomainName' = "" - 'certificate' = ("locker:certificate:" + $($wsaCertificate.vmid) + ":" + $($wsaCertificate.alias)) - 'contentLibraryItemId' = $contentLibraryItemId - 'fipsMode' = "false" - } - #### Generate Workspace ONE Access Details - if (!$PsBoundParameters.ContainsKey("standard")) { - $clusterLbProperties = @() - $clusterLbProperties += [pscustomobject]@{ - 'controllerType' = "NSX_T" - 'hostName' = $jsonInput.clusterFqdn - 'lockerCertificate' = ("locker:certificate:" + $($wsaCertificate.vmid) + ":" + $($wsaCertificate.alias)) + $infrastructurePropertiesObject = @() + $infrastructurePropertiesObject += [pscustomobject]@{ + 'acceptEULA' = "true" + 'enableTelemetry' = "true" + 'regionName' = "" + 'zoneName' = "" + 'dataCenterVmid' = $datacenterName.dataCenterVmid + 'vCenterName' = ($jsonInput.vcFqdn).Split(".")[0] + 'vCenterHost' = $jsonInput.vcFqdn + 'vcUsername' = $vcCredentials.userName + 'vcPassword' = ("locker:password:" + $($vcCredentials.vmid) + ":" + $($vcCredentials.alias)) + 'defaultPassword' = ("locker:password:" + $($defaultPassword.vmid) + ":" + $($defaultPassword.alias)) + 'certificate' = ("locker:certificate:" + $($wsaCertificate.vmid) + ":" + $($wsaCertificate.alias)) + 'cluster' = ($jsonInput.vcDatacenter + "#" + $jsonInput.vcCluster) + 'storage' = $jsonInput.vcDatastore + 'diskMode' = "thin" + 'network' = $jsonInput.xintNetwork + 'masterVidmEnabled' = "false" + 'dns' = $jsonInput.xintNetworkDns + 'domain' = $jsonInput.xintNetworkDomain + 'gateway' = $jsonInput.xintNetworkGateway + 'netmask' = $jsonInput.xintNetworkMask + 'searchpath' = $jsonInput.xintNetworkSearch + 'timeSyncMode' = "ntp" + 'ntp' = $jsonInput.xintNetworkNtp + 'vcfProperties' = '{"vcfEnabled":true,"sddcManagerDetails":[{"sddcManagerHostName":"' + $jsonInput.sddcManagerFqdn + '","sddcManagerName":"default","sddcManagerVmid":"default"}]}' } - $clusterDelegateObject = @() - $clusterDelegateObject += [pscustomobject]@{ - 'ip' = $jsonInput.clusterIp + $infrastructureObject = @() + $infrastructureObject += [pscustomobject]@{ + 'properties' = ($infrastructurePropertiesObject | Select-Object -Skip 0) } - $clusterVipsObject = @() - $clusterVipsObject += [pscustomobject]@{ - 'type' = "vidm-lb" - 'properties' = ($clusterLbProperties | Select-Object -Skip 0) + ### Generate the Properties Details + if ($PsBoundParameters.ContainsKey("useContentLibrary")) { + $contentLibraryItems = ((Get-vRSLCMDatacenterVcenter -datacenterVmid $datacenterName.dataCenterVmid -vcenterName ($jsonInput.vcFqdn).Split(".")[0]).contentLibraries | Where-Object { $_.contentLibraryName -eq $jsonInput.contentLibraryName }).contentLibraryItems + if ($contentLibraryItems) { + $contentLibraryItemId = ($contentLibraryItems | Where-Object { $_.contentLibraryItemName -match "identity-manager-$wsaVersion" }).contentLibraryItemId + } else { + Write-Error "Unable to find vSphere Content Library ($($jsonInput.contentLibraryName)) or Content Library Item in VMware Aria Suite Lifecycle: PRE_VALIDATION_FAILED" + Break + } } - $clusterVipsObject += [pscustomobject]@{ - 'type' = "vidm-delegate" - 'properties' = ($clusterDelegateObject | Select-Object -Skip 0) + $productPropertiesObject = @() + $productPropertiesObject += [pscustomobject]@{ + 'vidmAdminPassword' = ("locker:password:" + $($wsaPassword.vmid) + ":" + $($wsaPassword.alias)) + 'syncGroupMembers' = $true + 'nodeSize' = ($jsonInput.wsaNodeSize).ToLower() + 'defaultConfigurationEmail' = $jsonInput.configAdminUserEmail + 'defaultConfigurationUsername' = $jsonInput.configAdminUserName + 'defaultConfigurationPassword' = ("locker:password:" + $($configAdminPassword.vmid) + ":" + $($configAdminPassword.alias)) + 'defaultTenantAlias' = "" + 'vidmDomainName' = "" + 'certificate' = ("locker:certificate:" + $($wsaCertificate.vmid) + ":" + $($wsaCertificate.alias)) + 'contentLibraryItemId' = $contentLibraryItemId + 'fipsMode' = "false" + 'monitorWithvROps' = "false" + 'vROpsEnvironmentId' = "" } - $clusterObject = @() - $clusterObject += [pscustomobject]@{ - 'clusterVips' = $clusterVipsObject + #### Generate Workspace ONE Access Details + if (!$PsBoundParameters.ContainsKey("standard")) { + $clusterLbProperties = @() + $clusterLbProperties += [pscustomobject]@{ + 'controllerType' = "NSX_T" + 'hostName' = $jsonInput.clusterFqdn + 'lockerCertificate' = ("locker:certificate:" + $($wsaCertificate.vmid) + ":" + $($wsaCertificate.alias)) + } + + $clusterDelegateObject = @() + $clusterDelegateObject += [pscustomobject]@{ + 'ip' = $jsonInput.databaseIp + } + + $clusterVipsObject = @() + $clusterVipsObject += [pscustomobject]@{ + 'type' = "vidm-lb" + 'properties' = ($clusterLbProperties | Select-Object -Skip 0) + } + $clusterVipsObject += [pscustomobject]@{ + 'type' = "vidm-delegate" + 'properties' = ($clusterDelegateObject | Select-Object -Skip 0) + } + + $clusterObject = @() + $clusterObject += [pscustomobject]@{ + 'clusterVips' = $clusterVipsObject + } } - } - #### Generate Worspace ONE Access Node Details - $wsaPrimaryProperties = @() - $wsaPrimaryProperties += [pscustomobject]@{ - 'hostName' = $jsonInput.hostNameNodeA - 'vmName' = $jsonInput.vmNameNodeA - 'ip' = $jsonInput.ipNodeA - } + #### Generate Worspace ONE Access Node Details + $wsaPrimaryProperties = @() + $wsaPrimaryProperties += [pscustomobject]@{ + 'hostName' = $jsonInput.hostNameNodeA + 'vmName' = $jsonInput.vmNameNodeA + 'ip' = $jsonInput.ipNodeA + 'vidmRootPassword' = ("locker:password:" + $($wsaRootPassword.vmid) + ":" + $($wsaRootPassword.alias)) + } - $wsaSecondary1Properties = @() - $wsaSecondary1Properties += [pscustomobject]@{ - 'hostName' = $jsonInput.hostNameNodeB - 'vmName' = $jsonInput.vmNameNodeB - 'ip' = $jsonInput.ipNodeB - } + $wsaSecondary1Properties = @() + $wsaSecondary1Properties += [pscustomobject]@{ + 'hostName' = $jsonInput.hostNameNodeB + 'vmName' = $jsonInput.vmNameNodeB + 'ip' = $jsonInput.ipNodeB + 'vidmRootPassword' = ("locker:password:" + $($wsaRootPassword.vmid) + ":" + $($wsaRootPassword.alias)) + } - $wsaSecondary2Properties = @() - $wsaSecondary2Properties += [pscustomobject]@{ - 'hostName' = $jsonInput.hostNameNodeC - 'vmName' = $jsonInput.vmNameNodeC - 'ip' = $jsonInput.ipNodeC - } + $wsaSecondary2Properties = @() + $wsaSecondary2Properties += [pscustomobject]@{ + 'hostName' = $jsonInput.hostNameNodeC + 'vmName' = $jsonInput.vmNameNodeC + 'ip' = $jsonInput.ipNodeC + 'vidmRootPassword' = ("locker:password:" + $($wsaRootPassword.vmid) + ":" + $($wsaRootPassword.alias)) + } - $nodesObject = @() - $nodesobject += [pscustomobject]@{ - 'type' = "vidm-primary" - 'properties' = ($wsaPrimaryProperties | Select-Object -Skip 0) - } - if (!$PsBoundParameters.ContainsKey("standard")) { + $nodesObject = @() $nodesobject += [pscustomobject]@{ - 'type' = "vidm-secondary" - 'properties' = ($wsaSecondary1Properties | Select-Object -Skip 0) + 'type' = "vidm-primary" + 'properties' = ($wsaPrimaryProperties | Select-Object -Skip 0) } - $nodesobject += [pscustomobject]@{ - 'type' = "vidm-secondary" - 'properties' = ($wsaSecondary2Properties | Select-Object -Skip 0) + if (!$PsBoundParameters.ContainsKey("standard")) { + $nodesobject += [pscustomobject]@{ + 'type' = "vidm-secondary" + 'properties' = ($wsaSecondary1Properties | Select-Object -Skip 0) + } + $nodesobject += [pscustomobject]@{ + 'type' = "vidm-secondary" + 'properties' = ($wsaSecondary2Properties | Select-Object -Skip 0) + } } - } - $productsObject = @() - $productsObject += [pscustomobject]@{ - 'id' = "vidm" - 'version' = $wsaVersion - 'properties' = ($productPropertiesObject | Select-Object -Skip 0) - 'clusterVIP' = ($clusterObject | Select-Object -Skip 0) - 'nodes' = $nodesObject - } + $productsObject = @() + $productsObject += [pscustomobject]@{ + 'id' = "vidm" + 'version' = $wsaVersion + 'properties' = ($productPropertiesObject | Select-Object -Skip 0) + 'clusterVIP' = ($clusterObject | Select-Object -Skip 0) + 'nodes' = $nodesObject + } - $wsaDeploymentObject = @() - $wsaDeploymentObject += [pscustomobject]@{ - 'environmentId' = $jsonInput.environmentName - 'environmentName' = $jsonInput.environmentName - 'infrastructure' = ($infrastructureObject | Select-Object -Skip 0) - 'products' = $productsObject - } + $wsaDeploymentObject = @() + $wsaDeploymentObject += [pscustomobject]@{ + 'environmentId' = $jsonInput.environmentName + 'environmentName' = $jsonInput.environmentName + 'infrastructure' = ($infrastructureObject | Select-Object -Skip 0) + 'products' = $productsObject + } - $wsaDeploymentObject | ConvertTo-Json -Depth 12 | Out-File -Encoding UTF8 -FilePath $jsonSpecFileName - Write-Output "Creation of Deployment JSON Specification file for $deploymentType Workspace ONE Access: SUCCESSFUL" + $wsaDeploymentObject | ConvertTo-Json -Depth 12 | Out-File -Encoding UTF8 -FilePath $jsonSpecFileName + Write-Output "Creation of Deployment JSON Specification file for $deploymentType Workspace ONE Access: SUCCESSFUL" + } else { + Write-Error "Datacenter Provided in the JSON Specification File ($($jsonInput.xintDatacenter)) does not exist, create and retry" + } } else { - Write-Error "Datacenter Provided in the JSON Specification File ($($jsonInput.xintDatacenter)) does not exist, create and retry" + Write-Error "Root Password with alias ($($jsonInput.rootPasswordAlias)) not found in the VMware Aria Suite Lifecycle Locker, add and retry" } } else { - Write-Error "Root Password with alias ($($jsonInput.adminPasswordAlias)) not found in the VMware Aria Suite Lifecycle Locker, add and retry" + Write-Error "Admin Password with alias ($($jsonInput.adminPasswordAlias)) not found in the VMware Aria Suite Lifecycle Locker, add and retry" } } else { - Write-Error "Admin Password with alias ($($jsonInput.globalPasswordAlias)) not found in the VMware Aria Suite Lifecycle Locker, add and retry" + Write-Error "Global Admin Password with alias ($($jsonInput.globalPasswordAlias)) not found in the VMware Aria Suite Lifecycle Locker, add and retry" } } else { Write-Error "Certificate with alias ($($jsonInput.configAdminPasswordAlias)) not found in the VMware Aria Suite Lifecycle Locker, add and retry"