From 5410774d735d1dc116fb34339f47f92f00f6aaa9 Mon Sep 17 00:00:00 2001 From: Gary Blake <31245616+GaryJBlake@users.noreply.github.com> Date: Fri, 22 Dec 2023 14:59:16 +0000 Subject: [PATCH] feat: add oneclick cmdlets for iom (#448) - Added `Export-IomJsonSpec` cmdlet to generate a JSON specification file for Intelligent Operations Management. - Added `Invoke-IomDeployment` cmdlet to perform an end-to-end deployment of Intelligent Operations Management. - Added `Invoke-UndoIomDeployment` cmdlet to perform removal of Intelligent Operations Management. - Removed `iomDeployAriaOperations.ps1` from the \SampleScripts\ directory as functionality now provided using the `Invoke-IomDeployment` cmdlet. - Removed `iomConfigureAriaOperations.ps1` from the \SampleScripts\ directory as functionality now provided using the `Invoke-IomDeployment` cmdlet. Signed-off-by: Gary Blake --- CHANGELOG.md | 5 + PowerValidatedSolutions.psd1 | 2 +- PowerValidatedSolutions.psm1 | 554 +++++++++++++++++- .../iom/iomConfigureAriaOperations.ps1 | 153 ----- SampleScripts/iom/iomDeployAriaOperations.ps1 | 247 -------- 5 files changed, 556 insertions(+), 405 deletions(-) delete mode 100644 SampleScripts/iom/iomConfigureAriaOperations.ps1 delete mode 100644 SampleScripts/iom/iomDeployAriaOperations.ps1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 4abdea11..816fde4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,9 @@ - Added `Remove-DefaultAdapters` cmdlet to support removing the default vCenter Server and vSAN adapters from VMware Aria Operations. - Added `Undo-vROPSDeployment` cmdlet to support removing VMware Aria Operations from VMware Aria Suite Lifecycle. - Added `Get-NsxtLdapStatus` cmdlet to retrieve the configuration status of an identity source in NSX. +- Added `Export-IomJsonSpec` cmdlet to generate a JSON specification file for Intelligent Operations Management. +- Added `Invoke-IomDeployment` cmdlet to perform an end-to-end deployment of Intelligent Operations Management. +- Added `Invoke-UndoIomDeployment` cmdlet to perform removal of Intelligent Operations Management. - Fixed `Undo-SddcManagerRole` cmdlet where a blank line is returned due to no API response data. - Fixed `Undo-WorkspaceOneNsxtIntegration` cmdlet for a typo in the post validation message. - Fixed `Undo-NsxtVimRole` cmdlet where a blank line is returned due to no API response data. @@ -84,6 +87,8 @@ - Removed `iamConfigureWorkspaceOneAccess.ps1` from the \SampleScripts\ directory as functionality now provided using the `Invoke-IamDeployment` cmdlet. - Removed `iamConfigureNsx.ps1` from the \SampleScripts\ directory as functionality now provided using the `Invoke-IamDeployment` cmdlet. - Removed `iamUndoDeployment.ps1` from the \SampleScripts\ directory as functionality now provided using the `Invoke-UndoIamDeployment` cmdlet. +- Removed `iomDeployAriaOperations.ps1` from the \SampleScripts\ directory as functionality now provided using the `Invoke-IomDeployment` cmdlet. +- Removed `iomConfigureAriaOperations.ps1` from the \SampleScripts\ directory as functionality now provided using the `Invoke-IomDeployment` cmdlet. ## v2.7.1 diff --git a/PowerValidatedSolutions.psd1 b/PowerValidatedSolutions.psd1 index fa6cc678..73bc0909 100644 --- a/PowerValidatedSolutions.psd1 +++ b/PowerValidatedSolutions.psd1 @@ -11,7 +11,7 @@ RootModule = 'PowerValidatedSolutions.psm1' # Version number of this module. - ModuleVersion = '2.8.0.1023' + ModuleVersion = '2.8.0.1024' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/PowerValidatedSolutions.psm1 b/PowerValidatedSolutions.psm1 index 52a8a94d..358a8388 100644 --- a/PowerValidatedSolutions.psm1 +++ b/PowerValidatedSolutions.psm1 @@ -13188,6 +13188,552 @@ Export-ModuleMember -Function Update-vRLIContentPack ####################################################################################################################### #Region I N T E L L I G E N T O P E R A T I O N S M A N A G E M E N T F U N C T I O N S ########### +Function Export-IomJsonSpec { + <# + .SYNOPSIS + Create JSON specification for Intelligent Operations Management. + + .DESCRIPTION + The Export-IomJsonSpec cmdlet creates the JSON specification file using the Planning and Preparation workbook + to deploy the Intelligent Operations Management for VMWare Cloud Foundation validated solution: + - Validates that the Planning and Preparation is available + - Generates the JSON specification file using the Planning and Preparation workbook + + .EXAMPLE + Export-IomJsonSpec -workbook .\pnp-workbook.xlsx -jsonFile .\iomDeploySpec.json + This example creates a JSON specification Intelligent Operations Management using the Planning and Preparation Workbook. + #> + + Param ( + [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$workbook, + [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$jsonFile + ) + + Try { + if (!$PsBoundParameters.ContainsKey("workbook")) { + $workbook = Get-ExternalFileName -title "Select the Planning and Preparation Workbook (.xlsx)" -fileType "xlsx" -location "default" + } + if (Test-Path -Path $workbook) { + $pnpWorkbook = Open-ExcelPackage -Path $Workbook + $jsonObject = @() + $jsonObject += [pscustomobject]@{ + 'sddcManagerFqdn' = $pnpWorkbook.Workbook.Names["sddc_mgr_fqdn"].Value + 'sddcManagerUser' = $pnpWorkbook.Workbook.Names["sso_default_admin"].Value + 'sddcManagerPass' = $pnpWorkbook.Workbook.Names["administrator_vsphere_local_password"].Value + 'mgmtSddcDomainName' = $pnpWorkbook.Workbook.Names["mgmt_sddc_domain"].Value + 'licenseAlias' = $pnpWorkbook.Workbook.Names["vrops_license_alias"].Value + 'licenseKey' = if ($pnpWorkbook.Workbook.Names["vrs_license"].Value) { $pnpWorkbook.Workbook.Names["vrs_license"].Value } else { $pnpWorkbook.Workbook.Names["vrops_license"].Value } + 'certificateAlias' = $pnpWorkbook.Workbook.Names["xreg_vrops_virtual_hostname"].Value + 'rootPasswordAlias' = $pnpWorkbook.Workbook.Names["xreg_vrops_root_password_alias"].Value + 'rootPassword' = $pnpWorkbook.Workbook.Names["xreg_vrops_root_password"].Value + 'rootUserName' = "root" + 'xintPasswordAlias' = $pnpWorkbook.Workbook.Names["vrslcm_xreg_env_password_alias"].Value + 'xintPassword' = $pnpWorkbook.Workbook.Names["vrslcm_xreg_env_password"].Value + 'xintUserName' = $pnpWorkbook.Workbook.Names["vrslcm_xreg_admin_username"].Value + 'vmFolderOperations' = $pnpWorkbook.Workbook.Names["xreg_vrops_vm_folder"].Value + 'vmFolderProxies' = $pnpWorkbook.Workbook.Names["region_vrops_collector_vm_folder"].Value + 'vmListOperations' = $pnpWorkbook.Workbook.Names["xreg_vrops_nodea_hostname"].Value + "," + $pnpWorkbook.Workbook.Names["xreg_vrops_nodeb_hostname"].Value + "," + $pnpWorkbook.Workbook.Names["xreg_vrops_nodec_hostname"].Value + 'vmListProxies' = $pnpWorkbook.Workbook.Names["region_vropsca_hostname"].Value + "," + $pnpWorkbook.Workbook.Names["region_vropscb_hostname"].Value + 'vmListAll' = $pnpWorkbook.Workbook.Names["xreg_vrops_nodea_hostname"].Value + "," + $pnpWorkbook.Workbook.Names["xreg_vrops_nodeb_hostname"].Value + "," + $pnpWorkbook.Workbook.Names["xreg_vrops_nodec_hostname"].Value + "," + $pnpWorkbook.Workbook.Names["region_vropsca_hostname"].Value + "," + $pnpWorkbook.Workbook.Names["region_vropscb_hostname"].Value + 'antiAffinityRuleNameOperations' = $pnpWorkbook.Workbook.Names["xreg_vrops_anti_affinity_rule_name"].Value + 'antiAffinityRuleNameProxies' = $pnpWorkbook.Workbook.Names["xreg_vropsrc_anti_affinity_rule_name"].Value + 'drsGroupNameOperations' = $pnpWorkbook.Workbook.Names["xreg_vrops_vm_group_name"].Value + 'drsGroupNameIdentity' = $pnpWorkbook.Workbook.Names["xreg_wsa_vm_group_name"].Value + 'drsGroupNameProxies' = $pnpWorkbook.Workbook.Names["region_vropsrc_vm_group_name"].Value + 'drsGroupNameAz' = $pnpWorkbook.Workbook.Names["mgmt_az1_vm_group_name"].Value + 'vmToVmRuleNameWsa' = $pnpWorkbook.Workbook.Names["xreg_wsa_vrops_vm_to_vm_rule_name"].Value + 'vmToVmRuleNameOperations' = $pnpWorkbook.Workbook.Names["xreg_vrops_vm_to_vm_rule_name"].Value + 'vmToVmRuleNameProxies' = $pnpWorkbook.Workbook.Names["xreg_vrops_vm_to_vm_rule_name"].Value + 'stretchedCluster' = $pnpWorkbook.Workbook.Names["mgmt_stretched_cluster_chosen"].Value + 'currency' = $pnpWorkbook.Workbook.Names["xreg_vrops_currency"].Value + 'wsaFqdn' = $pnpWorkbook.Workbook.Names["xreg_wsa_nodea_hostname"].Value + "." + $pnpWorkbook.Workbook.Names["parent_dns_zone"].Value + 'wsaUser' = $pnpWorkbook.Workbook.Names["local_admin_username"].Value + 'wsaPass' = $pnpWorkbook.Workbook.Names["local_admin_password"].Value + 'domainFqdn' = $pnpWorkbook.Workbook.Names["region_ad_child_fqdn"].Value + 'domainBindUser' = $pnpWorkbook.Workbook.Names["child_svc_vsphere_ad_user"].Value + 'domainBindPass' = $pnpWorkbook.Workbook.Names["child_svc_vsphere_ad_password"].Value + 'serviceAccountOperationsVcf' = $pnpWorkbook.Workbook.Names["iom_vcf_svc_user"].Value + 'vsphereRoleNameOperations' = $pnpWorkbook.Workbook.Names["iom_vsphere_role"].Value + 'wsaBindUser' = $pnpWorkbook.Workbook.Names["child_svc_wsa_ad_user"].Value + 'wsaBindPass' = $pnpWorkbook.Workbook.Names["child_svc_wsa_ad_password"].Value + 'baseDnGroup' = $pnpWorkbook.Workbook.Names["child_ad_groups_ou"].Value + 'adGroups' = "$($pnpWorkbook.Workbook.Names["group_gg_vrops_admins"].Value)","$($pnpWorkbook.Workbook.Names["group_gg_vrops_content_admins"].Value)","$($pnpWorkbook.Workbook.Names["group_gg_vrops_read_only"].Value)" + 'smtpServer' = $pnpWorkbook.Workbook.Names["smtp_server"].Value + 'smtpPort' = $pnpWorkbook.Workbook.Names["smtp_server_port"].Value -as [Int] + 'smtpAuthUser' = $pnpWorkbook.Workbook.Names["smtp_sender_username"].Value + 'smtpAuthPass' = $pnpWorkbook.Workbook.Names["smtp_sender_password"].Value + 'senderAddress' = $pnpWorkbook.Workbook.Names["xreg_vrops_smtp_sender_email_address"].Value + 'operationsAdminGroup' = $pnpWorkbook.Workbook.Names["group_gg_vrops_admins"].Value + 'operationsContentAdminGroup' = $pnpWorkbook.Workbook.Names["group_gg_vrops_content_admins"].Value + 'operationsReadOnlyGroup' = $pnpWorkbook.Workbook.Names["group_gg_vrops_read_only"].Value + 'iomVcfServiceAccount' = $pnpWorkbook.Workbook.Names["iom_vcf_svc_user"].Value + "@" + $pnpWorkbook.Workbook.Names["child_dns_zone"].Value + 'iomVcfServiceAccountPassword' = $pnpWorkbook.Workbook.Names["iom_vcf_svc_password"].Value + 'iomVsphereServiceAccount' = $pnpWorkbook.Workbook.Names["iom_vsphere_svc_user"].Value + "@" + $pnpWorkbook.Workbook.Names["child_dns_zone"].Value + 'iomVsphereServiceAccountPassword' = $pnpWorkbook.Workbook.Names["iom_vsphere_svc_password"].Value + 'collectorGroupName' = $pnpWorkbook.Workbook.Names["region_vrops_collector_group_name"].Value + 'defaultCollectorGroup' = $pnpWorkbook.Workbook.Names["xreg_vrops_default_collector_group"].Value + 'ipListOperations' = $pnpWorkbook.Workbook.Names["xreg_vrops_virtual_ip"].Value + "," + $pnpWorkbook.Workbook.Names["xreg_vrops_nodea_ip"].Value + "," + $pnpWorkbook.Workbook.Names["xreg_vrops_nodeb_ip"].Value + "," + $pnpWorkbook.Workbook.Names["xreg_vrops_nodec_ip"].Value + 'ipListProxies' = $pnpWorkbook.Workbook.Names["region_vropsca_ip"].Value + "," + $pnpWorkbook.Workbook.Names["region_vropscb_ip"].Value + 'ipListIdentity' = $pnpWorkbook.Workbook.Names["xreg_wsa_virtual_ip"].Value + "," + $pnpWorkbook.Workbook.Names["xreg_wsa_nodea_ip"].Value + "," + $pnpWorkbook.Workbook.Names["xreg_wsa_nodeb_ip"].Value + "," + $pnpWorkbook.Workbook.Names["xreg_wsa_nodec_ip"].Value + 'pingAdapterNameProxies' = $pnpWorkbook.Workbook.Names["mgmt_sddc_domain"].Value + "-operations-proxies" + 'pingAdapterNameOperations' = $pnpWorkbook.Workbook.Names["xreg_vrops_virtual_hostname"].Value + "-cluster" + 'pingAdapterNameIdentity' = $pnpWorkbook.Workbook.Names["xreg_wsa_virtual_hostname"].Value + "-cluster" + 'environmentName' = $pnpWorkbook.Workbook.Names["vrslcm_xreg_env"].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 + Foreach ($jsonValue in $jsonInput.psobject.properties) { + if ($jsonValue.value -eq "Value Missing" -or $null -eq $jsonValue.value ) { + $issueWithJson = $true + } + } + if ($issueWithJson) { + Write-Error "Creation of JSON Specification file for Intelligent Operations Management, missing data: POST_VALIDATION_FAILED" + } else { + Write-Output "Creation of JSON Specification file for Intelligent Operations Management: SUCCESSFUL" + } + } else { + Write-Error "Planning and Preparation Workbook (.xlsx) ($workbook): File Not Found" + } + } Catch { + Debug-ExceptionWriter -object $_ + } +} +Export-ModuleMember -Function Export-IomJsonSpec + +Function Invoke-IomDeployment { + <# + .SYNOPSIS + End-to-end Deployment of Intelligent Operations and Management. + + .DESCRIPTION + The Invoke-IomDeployment cmdlet is a single function to implement the configuration of the Intelligent + Operations and Management for VMware Cloud Foundation validated solution. + + .EXAMPLE + Invoke-IomDeployment -jsonFile .\iomDeploySpec.json -workbook .\pnpWorkbook.xlsx -certificates ".\certificates\" -binaries ".\binaries\" + This example configures Intelligent Operations and Management for VMware Cloud Foundation using the JSON spec supplied + #> + + Param ( + [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$jsonFile, + [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workbook, + [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$certificates, + [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$binaries, + [Parameter (Mandatory = $false, ParameterSetName = 'useContentLibrary')] [ValidateNotNullOrEmpty()] [Switch]$useContentLibrary, + [Parameter (Mandatory = $false, ParameterSetName = 'useContentLibrary')] [ValidateNotNullOrEmpty()] [String]$contentLibrary, + [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$nested + ) + + $solutionName = "Intelligent Operations Management for VMware Cloud Foundation" + $operationsProductName = "VMware Aria Operations" + $lcmProductName = "VMware Aria Suite Lifecycle" + + Try { + if (Test-Path -Path $jsonFile) { + if (Test-Path -Path $workbook) { + $jsonInput = (Get-Content -Path $jsonFile) | ConvertFrom-Json + $operationsPem = $certificates + $jsonInput.certificateAlias + ".2.chain.pem" + if (Test-Path -Path $operationsPem) { + if (Test-VCFConnection -server $jsonInput.sddcManagerFqdn ) { + if (Test-VCFAuthentication -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass) { + $allWorkloadDomains = Get-VCFWorkloadDomain + $pvsModulePath = (Get-InstalledModule -Name PowerValidatedSolutions).InstalledLocation + $operationsVsphereTemplate = $pvsModulePath + "\vSphereRoles\" + "aria-operations-vsphere-integration.role" + $operationsNotifications = $pvsModulePath + "\SampleNotifications\" + "aria-operations-notifications-vcf.csv" + + Show-PowerValidatedSolutionsOutput -type NOTE -message "Starting Deployment of $solutionName" + Show-PowerValidatedSolutionsOutput -message "Assigning SDDC Manager Role to a Service Account" + $StatusMsg = Add-SddcManagerRole -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.domainFqdn -domainBindUser $jsonInput.domainBindUser -domainBindPass $jsonInput.domainBindPass -principal $jsonInput.serviceAccountOperationsVcf -role ADMIN -type user -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Defining a Custom Role in vSphere" + foreach ($sddcDomain in $allWorkloadDomains) { + if ($sddcDomain.type -eq "MANAGEMENT" -or ($sddcDomain.type -eq "VI" -and $sddcDomain.ssoName -ne "vsphere.local")) { + $StatusMsg = Add-vSphereRole -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -sddcDomain $sddcDomain.name -roleName $jsonInput.vsphereRoleNameOperations -template $operationsVsphereTemplate -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Configuring Service Account Permissions for vSphere Integration" + foreach ($sddcDomain in $allWorkloadDomains) { + if ($sddcDomain.type -eq "MANAGEMENT" -or ($sddcDomain.type -eq "VI" -and $sddcDomain.ssoName -ne "vsphere.local")) { + $StatusMsg = Add-vCenterGlobalPermission -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -sddcDomain $sddcDomain.name -domain $jsonInput.domainFqdn -domainBindUser $jsonInput.domainBindUser -domainBindPass $jsonInput.domainBindPass -principal $jsonInput.serviceAccountOperationsVcf -role $jsonInput.vsphereRoleNameOperations -propagate true -type user -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ($StatusMsg) { Show-PowerValidatedSolutionsOutput -message $StatusMsg } elseif ($WarnMsg) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ($ErrorMsg) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Creating Virtual Machine and Template Folders for $operationsProductName Appliances" + $StatusMsg = Add-VMFolder -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.mgmtSddcDomainName -folderName $jsonInput.vmFolderOperations -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + $StatusMsg = Add-VMFolder -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.mgmtSddcDomainName -folderName $jsonInput.vmFolderProxies -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Preparing the NSX to $operationsProductName Integration" + Show-PowerValidatedSolutionsOutput -type NOTE -message "CURRENTLY NO AUTOMATION" + foreach ($sddcDomain in $allWorkloadDomains) { + + } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Adding $operationsProductName License to $lcmProductName" + $StatusMsg = New-vRSLCMLockerLicense -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -alias $jsonInput.licenseAlias -license $jsonInput.licenseKey -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Importing the Certificate for $operationsProductName to $lcmProductName" + $StatusMsg = Import-vRSLCMLockerCertificate -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -certificateAlias $jsonInput.certificateAlias -certChainPath $operationsPem -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Adding the $operationsProductName Passwords to $lcmProductName" + $StatusMsg = New-vRSLCMLockerPassword -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -alias $jsonInput.rootPasswordAlias -password $jsonInput.rootPassword -userName $jsonInput.rootUserName -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + $StatusMsg = New-vRSLCMLockerPassword -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -alias $jsonInput.xintPasswordAlias -password $jsonInput.xintPassword -userName $jsonInput.xintUserName -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + + # Show-PowerValidatedSolutionsOutput -message "Adding the Load Balancer for $operationsProductName in $lcmProductNamee" + # Show-PowerValidatedSolutionsOutput -type NOTE -message "CURRENTLY NO AUTOMATION" + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Deploying $operationsProductName Using $lcmProductName" + if ($PsBoundParameters.ContainsKey("nested")) { + $StatusMsg = New-vROPSDeployment -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -workbook $workbook -monitor -nested -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + } elseif ($PsBoundParameters.ContainsKey("nested") -and $PsBoundParameters.ContainsKey("useContentLibrary")) { + $StatusMsg = New-vROPSDeployment -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -workbook $workbook -monitor -nested -useContentLibrary -contentLibrary $contentLibrary -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + } elseif ($PsBoundParameters.ContainsKey("useContentLibrary")) { + $StatusMsg = New-vROPSDeployment -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -workbook $workbook -monitor -useContentLibrary -contentLibrary $contentLibrary -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + } else { + $StatusMsg = New-vROPSDeployment -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -workbook $workbook -monitor -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + } + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -Type INFO -Message "$StatusMsg" }; if ($WarnMsg) { Show-PowerValidatedSolutionsOutput -Type WARNING -Message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -Type ERROR -Message $ErrorMsg; $failureDetected = $true } + if ( $StatusMsg -match "FAILED" -or $WarnMsg -match "FAILED" ) { Show-PowerValidatedSolutionsOutput -Type ERROR -Message "Deployment of $operationsProductName FAILED"; $failureDetected = $true } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Activating Data Persistence on VMware Cloud Proxy Appliances for the $operationsProductName Virtual Machines" + Show-PowerValidatedSolutionsOutput -type NOTE -message "CURRENTLY NO AUTOMATION" + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Moving the $operationsProductName Appliances to the Dedicated Folders" + $StatusMsg = Move-VMtoFolder -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.mgmtSddcDomainName -vmList $jsonInput.vmListOperations -folder $jsonInput.vmFolderOperations -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg -match "SUCCESSFUL") { Show-PowerValidatedSolutionsOutput -message "Relocating $operationsProductName Cluster Appliances to Dedicated Folder: SUCCESSFUL" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -Type WARNING -Message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -Type ERROR -Message $ErrorMsg } + $StatusMsg = Move-VMtoFolder -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.mgmtSddcDomainName -vmList $jsonInput.vmListProxies -folder $jsonInput.vmFolderProxies -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg -match "SUCCESSFUL") { Show-PowerValidatedSolutionsOutput -message "Relocating $operationsProductName Collector Appliances to Dedicated Folder: SUCCESSFUL" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -Type WARNING -Message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -Type ERROR -Message $ErrorMsg } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Configuring vSphere DRS Anti-Affinity Rules for the $operationsProductName Appliances" + $StatusMsg = Add-AntiAffinityRule -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.mgmtSddcDomainName -ruleName $jsonInput.antiAffinityRuleNameOperations -antiAffinityVMs $jsonInput.vmListOperations -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + $StatusMsg = Add-AntiAffinityRule -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.mgmtSddcDomainName -ruleName $jsonInput.antiAffinityRuleNameProxies -antiAffinityVMs $jsonInput.vmListProxies -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Creating a VM Group and Define the Startup Order of the $operationsProductName Analytics Appliances" + $StatusMsg = Add-ClusterGroup -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.mgmtSddcDomainName -drsGroupName $jsonInput.drsGroupNameOperations -drsGroupVMs $jsonInput.vmListOperations -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + $StatusMsg = Add-VmStartupRule -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.mgmtSddcDomainName -ruleName $jsonInput.vmToVmRuleNameWsa -vmGroup $jsonInput.drsGroupNameOperations -dependOnVmGroup $jsonInput.drsGroupNameIdentity -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Creating a VM Group and Define the Startup Order of the $operationsProductName Cloud Proxy Appliances" + $StatusMsg = Add-ClusterGroup -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.mgmtSddcDomainName -drsGroupName $jsonInput.drsGroupNameProxies -drsGroupVMs $jsonInput.vmListProxies -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg } + $StatusMsg = Add-VmStartupRule -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.mgmtSddcDomainName -ruleName $jsonInput.vmToVmRuleNameOperations -vmGroup $jsonInput.drsGroupNameProxies -dependOnVmGroup $jsonInput.drsGroupNameOperations -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg } + } + + if (!$failureDetected) { + if ($stretchedCluster -eq "Include") { + Show-PowerValidatedSolutionsOutput -message "Adding the $operationsProductName Appliances to the First Availability Zone VM Group" + $StatusMsg = Add-VmGroup -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.mgmtSddcDomainName -name $groupName -vmList $vmList -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Grouping the VMware Cloud Proxy Appliances" + $StatusMsg = Add-vROPSGroupRemoteCollectors -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -collectorGroupName $jsonInput.collectorGroupName -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Synchronizing the Active Directory Groups for $operationsProductName in Workspace ONE Access" + $StatusMsg = Add-WorkspaceOneDirectoryGroup -server $jsonInput.wsaFqdn -user $jsonInput.wsaUser -pass $jsonInput.wsaPass -domain $jsonInput.domainFqdn -bindUser $jsonInput.wsaBindUser -bindPass $jsonInput.wsaBindPass -baseDnGroup $jsonInput.baseDnGroup -adGroups $jsonInput.adGroups -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Configuring User Access in $operationsProductName" + $StatusMsg = Import-vROPSUserGroup -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.domainFqdn -groupName $jsonInput.operationsAdminGroup -role Administrator -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + $StatusMsg = Import-vROPSUserGroup -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.domainFqdn -groupName $jsonInput.operationsContentAdminGroup -role ContentAdmin -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + $StatusMsg = Import-vROPSUserGroup -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.domainFqdn -groupName $jsonInput.operationsReadOnlyGroup -role ReadOnly -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Setting the Currency for Cost Calculation in $operationsProductName" + $StatusMsg = Add-vROPSCurrency -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -currency $jsonInput.currency -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Configuring Email Alert Plug-in Settings for $operationsProductName" + $StatusMsg = Add-vROPSAlertPluginEmail -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -pluginName "Email-Alert-Plugin" -smtpServer $jsonInput.smtpServer -smtpPort $jsonInput.smtpPort -senderAddress $jsonInput.senderAddress -secureConnection true -protocol TLS -authentication false -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Removing Existing vCenter Server Adapter in $operationsProductName" + $StatusMsg = Remove-OperationsDefaultAdapter -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "Removing Default vCenter Server/vSAN Adapter and Credentials from VMware Aria Operations: SUCCESSFUL" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Activating the VMware Cloud Foundation Integration" + $StatusMsg = Register-vROPSManagementPack -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -state enable -packType VCF -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Configuring Credentials for SDDC Components in $operationsProductName" + $StatusMsg = Add-vROPSVcfCredential -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -serviceUser $jsonInput.iomVcfServiceAccount -servicePassword $jsonInput.iomVcfServiceAccountPassword -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + foreach ($sddcDomain in $allWorkloadDomains) { + $StatusMsg = Add-vROPSVcenterCredential -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $sddcDomain.name -serviceUser $jsonInput.iomVsphereServiceAccount -servicePassword $jsonInput.iomVsphereServiceAccountPassword -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + $nsxCertKey = $certificates + $sddcDomain.nsxtCluster.vipFqdn.Split('.')[0] + ".key" + $nsxCert = $certificates + $sddcDomain.nsxtCluster.vipFqdn.Split('.')[0] + ".cer" + if (Test-Path -Path $nsxCertKey,$nsxCert) { + $StatusMsg = Add-vROPSNsxCredential -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $sddcDomain.name -certificate -certificateData $nsxCert -certificateKey $nsxCertKey -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Configuring the VMware Cloud Foundation Integration" + Show-PowerValidatedSolutionsOutput -type NOTE -message "CURRENTLY NO AUTOMATION" + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Activating the VMware Infrastructure Health Integration in $operationsProductName" + $StatusMsg = Register-vROPSManagementPack -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -state enable -packType VMwareInfrastructureHealth -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Activating the Ping Integration in $operationsProductName" + $StatusMsg = Register-vROPSManagementPack -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -state enable -packType Ping -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Adding Ping Adapters for the $operationsProductName Nodes" + $StatusMsg = Add-vROPSAdapterPing -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -addressList $jsonInput.ipListOperations -adapterName $jsonInput.pingAdapterNameOperations -collectorGroupName $jsonInput.defaultCollectorGroup -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + $StatusMsg = Add-vROPSAdapterPing -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -addressList $jsonInput.ipListProxies -adapterName $jsonInput.pingAdapterNameProxies -collectorGroupName $jsonInput.collectorGroupName -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Adding Ping Adapters for the Clustered Workspace ONE Access" + $StatusMsg = Add-vROPSAdapterPing -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -addressList $jsonInput.ipListIdentity -adapterName $jsonInput.pingAdapterNameIdentity -collectorGroupName $jsonInput.defaultCollectorGroup -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Creating Notifications in $operationsProductName for VMware Cloud Foundation Issues" + $StatusMsg = Import-vROPSNotification -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -csvPath $operationsNotifications -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + } + } + } else { + Show-PowerValidatedSolutionsOutput -type ERROR -message "Certificate File (.pem) for $logsProductName ($operationsForLogsPem): File Not Found" + } + } else { + Show-PowerValidatedSolutionsOutput -type ERROR -message "Planning and Preparation Workbook (.xlsx) ($workbook): File Not Found" + } + } else { + Show-PowerValidatedSolutionsOutput -type ERROR -message "JSON Specification file for $solutionName ($jsonFile): File Not Found" + } + } Catch { + Debug-ExceptionWriter -object $_ + } +} +Export-ModuleMember -Function Invoke-IomDeployment + +Function Invoke-UndoIomDeployment { + <# + .SYNOPSIS + End-to-end Deployment of Intelligent Operations and Management. + + .DESCRIPTION + The Invoke-UndoIomDeployment cmdlet is a single function to remove the configuration of the Intelligent + Operations and Management for VMware Cloud Foundation validated solution. + + .EXAMPLE + Invoke-UndoIomDeployment -jsonFile .\iomDeploySpec.json + This example removes the configuration of Intelligent Operations and Management for VMware Cloud Foundation using the JSON spec supplied. + #> + + Param ( + [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$jsonFile + ) + + $solutionName = "Intelligent Operations Management for VMware Cloud Foundation" + $operationsProductName = "VMware Aria Operations" + $lcmProductName = "VMware Aria Suite Lifecycle" + + Try { + if (Test-Path -Path $jsonFile) { + if (Test-Path -Path $workbook) { + $jsonInput = (Get-Content -Path $jsonFile) | ConvertFrom-Json + if (Test-VCFConnection -server $jsonInput.sddcManagerFqdn ) { + if (Test-VCFAuthentication -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass) { + if (($vcfVcenterDetails = Get-vCenterServerDetail $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domainType "MANAGEMENT")) { + $allWorkloadDomains = Get-VCFWorkloadDomain + + Show-PowerValidatedSolutionsOutput -type NOTE -message "Starting Removal of $solutionName" + Show-PowerValidatedSolutionsOutput -message "Removing the Active Directory Groups for $operationsProductName in Workspace ONE Access" + $StatusMsg = Undo-WorkspaceOneDirectoryGroup -server $jsonInput.wsaFqdn -user $jsonInput.wsaUser -pass $jsonInput.wsaPass -domain $jsonInput.domainFqdn -bindUser $jsonInput.wsaBindUser -bindPass $jsonInput.wsaBindPass -baseDnGroup $jsonInput.baseDnGroup -adGroups $jsonInput.adGroups -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg } + + if (!$failureDetected) { + $StatusMsg = Undo-VmStartupRule -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.mgmtSddcDomainName -ruleName $jsonInput.vmToVmRuleNameOperations -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + Show-PowerValidatedSolutionsOutput -message "Removing a VM Group and Define the Startup Order of the $operationsProductName Cloud Proxy Appliances" + $StatusMsg = Undo-ClusterGroup -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.mgmtSddcDomainName -drsGroupName $jsonInput.drsGroupNameProxies -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + + if (!$failureDetected) { + $StatusMsg = Undo-VmStartupRule -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.mgmtSddcDomainName -ruleName $jsonInput.vmToVmRuleNameWsa -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + Show-PowerValidatedSolutionsOutput -message "Removing a VM Group and Define the Startup Order of the $operationsProductName Analytics Appliances" + $StatusMsg = Undo-ClusterGroup -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.mgmtSddcDomainName -drsGroupName $jsonInput.drsGroupNameOperations -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Removing vSphere DRS Anti-Affinity Rules for the $operationsProductName Appliances" + $StatusMsg = Undo-AntiAffinityRule -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.mgmtSddcDomainName -ruleName $jsonInput.antiAffinityRuleNameOperations -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + $StatusMsg = Undo-AntiAffinityRule -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.mgmtSddcDomainName -ruleName $jsonInput.antiAffinityRuleNameProxies -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + + if (!$failureDetected) { + if (Test-VsphereConnection -server $($vcfVcenterDetails.fqdn)) { + if (Test-VsphereAuthentication -server $vcfVcenterDetails.fqdn -user $vcfVcenterDetails.ssoAdmin -pass $vcfVcenterDetails.ssoAdminPass) { + foreach ($vm in ($jsonInput.vmListAll -Split ',')) { + if (Get-VM -name $vm -ErrorAction SilentlyContinue ) { + Get-VM -name $vm | Stop-VM -RunAsync -Confirm:$false -ErrorAction SilentlyContinue | Out-Null + Do {$powerState = (Get-VM -name $vm | Select-Object PowerState).PowerState } Until ($powerState -eq "PoweredOff") + Get-VM -name $vm | Remove-VM -DeletePermanently -Confirm:$false -ErrorAction SilentlyContinue | Out-Null + } + } + Disconnect-VIServer $vcfVcenterDetails.fqdn -Confirm:$false -WarningAction SilentlyContinue + Show-PowerValidatedSolutionsOutput -message "Deleting $operationsProductName from $lcmProductName" + $StatusMsg = Undo-vROPSDeployment -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 }; if ($WarnMsg) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ($ErrorMsg) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Removing the $operationsProductName Passwords to $lcmProductName" + $StatusMsg = Undo-vRSLCMLockerPassword -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -alias $jsonInput.rootPasswordAlias -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + $StatusMsg = Undo-vRSLCMLockerPassword -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -alias $jsonInput.xintPasswordAlias -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Removing $operationsProductName Certificate to $lcmProductName" + $StatusMsg = Undo-vRSLCMLockerCertificate -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -certificateAlias $jsonInput.certificateAlias -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Removing $operationsProductName License to $lcmProductName" + $StatusMsg = Undo-vRSLCMLockerLicense -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -alias $jsonInput.licenseAlias -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Removing the NSX to $operationsProductName Integration" + Show-PowerValidatedSolutionsOutput -type NOTE -message "CURRENTLY NO AUTOMATION" + foreach ($sddcDomain in $allWorkloadDomains) { + + } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Removing Virtual Machine and Template Folders for the $operationsProductName Appliances" + $StatusMsg = Undo-VMFolder -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.mgmtSddcDomainName -foldername $jsonInput.vmFolderOperations -folderType VM -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + $StatusMsg = Undo-VMFolder -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.mgmtSddcDomainName -foldername $jsonInput.vmFolderProxies -folderType VM -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Removing Service Account Permissions for vSphere Integration" + foreach ($sddcDomain in $allWorkloadDomains) { + if ($sddcDomain.type -eq "MANAGEMENT" -or ($sddcDomain.type -eq "VI" -and $sddcDomain.ssoName -ne "vsphere.local")) { + $StatusMsg = Undo-vCenterGlobalPermission -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -sddcDomain $sddcDomain.name -domain $jsonInput.domainFqdn -principal $jsonInput.serviceAccountOperationsVcf -type user -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ($StatusMsg) { Show-PowerValidatedSolutionsOutput -message $StatusMsg } elseif ($WarnMsg) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ($ErrorMsg) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Removing a Custom Role in vSphere" + foreach ($sddcDomain in $allWorkloadDomains) { + if ($sddcDomain.type -eq "MANAGEMENT" -or ($sddcDomain.type -eq "VI" -and $sddcDomain.ssoName -ne "vsphere.local")) { + $StatusMsg = Undo-vSphereRole -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -sddcDomain $sddcDomain.name -roleName $jsonInput.vsphereRoleNameOperations -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + } + } + + if (!$failureDetected) { + Show-PowerValidatedSolutionsOutput -message "Removing SDDC Manager Role to a Service Account" + $StatusMsg = Undo-SddcManagerRole -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -principal $jsonInput.serviceAccountOperationsVcf -type user -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg + if ( $StatusMsg ) { Show-PowerValidatedSolutionsOutput -message "$StatusMsg" }; if ( $WarnMsg ) { Show-PowerValidatedSolutionsOutput -type WARNING -message $WarnMsg }; if ( $ErrorMsg ) { Show-PowerValidatedSolutionsOutput -type ERROR -message $ErrorMsg; $failureDetected = $true } + } + } + } + } + } + } else { + Show-PowerValidatedSolutionsOutput -type ERROR -message "JSON Specification file for Intelligent Logging and Analytics ($jsonFile): File Not Found" + } + } Catch { + Debug-ExceptionWriter -object $_ + } +} +Export-ModuleMember -Function Invoke-UndoIomDeployment + Function Export-vROPsJsonSpec { <# .SYNOPSIS @@ -14321,13 +14867,13 @@ Function Update-vROPSAdapterCollecterGroup { } Export-ModuleMember -Function Update-vROPSAdapterCollecterGroup -Function Remove-OperationsDefaultAdapters { +Function Remove-OperationsDefaultAdapter { <# .SYNOPSIS Removes the default vCenter Server and vSAN Adapters from VMware Aria Operations. .DESCRIPTION - The Remove-OperationsDefaultAdapters cmdlet removes the default vCenter Server and vSAN adapters and associated + The Remove-OperationsDefaultAdapter cmdlet removes the default vCenter Server and vSAN adapters and associated credentials from VMware Aria Operations. The cmdlet connects to SDDC Manager using the -server, -user, and -password values. - Validates that network connectivity and authentication is possible to SDDC Manager @@ -14336,7 +14882,7 @@ Function Remove-OperationsDefaultAdapters { - Deletes the adapters and credentials from VMware Aria Operations .EXAMPLE - Remove-OperationsDefaultAdapters -server sfo-vcf01.sfo.rainpole.io -user administrator@vsphere.local -pass VMw@re1! + Remove-OperationsDefaultAdapter -server sfo-vcf01.sfo.rainpole.io -user administrator@vsphere.local -pass VMw@re1! This example deletes the default adapter and credentials from VMware Aria Operations .PARAMETER server @@ -14389,7 +14935,7 @@ Function Remove-OperationsDefaultAdapters { Debug-ExceptionWriter -object $_ } } -Export-ModuleMember -Function Remove-OperationsDefaultAdapters +Export-ModuleMember -Function Remove-OperationsDefaultAdapter Function Add-vROPSCurrency { <# diff --git a/SampleScripts/iom/iomConfigureAriaOperations.ps1 b/SampleScripts/iom/iomConfigureAriaOperations.ps1 deleted file mode 100644 index b6d371ae..00000000 --- a/SampleScripts/iom/iomConfigureAriaOperations.ps1 +++ /dev/null @@ -1,153 +0,0 @@ -# Copyright 2023 Broadcom. All Rights Reserved. -# SPDX-License-Identifier: BSD-2 - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -<# - .NOTES - =================================================================================================================== - Created by: Gary Blake - Senior Staff Solutions Architect - Creation Date: 2021-12-15 - =================================================================================================================== - - .CHANGELOG - - 1.0.001 (Gary Blake / 2022-02-16) - Added support for both VCF 4.3.x and VCF 4.4.x Planning and Prep Workbooks - - 1.1.000 (Gary Blake / 2022-10-04) - Added Support for VCF 4.5.x Planning and Prep Workbook - - 1.2.000 (Gary Blake / 2023-07-25) - Added Support for VCF 5.0.x Planning and Prep Workbook - - Removed Support for VCF 4.3.x Planning and Prep Workbook - - Improvements to message output - - Pull the .csv files from the install directory of PowerValidatedSolutions - - Automatically discover the latest SDDC Health Pack file in the -filepath - - 1.2.001 (Ryan Johnson / 2023-09-06) - Updated the product names for VMware Aria branding. - - Updated the script name for VMware Aria branding. - - =================================================================================================================== - .SYNOPSIS - Configure Integration of Aria Operations for Intelligent Operations Management - - .DESCRIPTION - The iomConfigureVrealizeOperations.ps1 provides a single script to configure the intergration of Aria Operations - as defined by the Intelligent Operations Management Validated Solution - - .EXAMPLE - iomConfigureVrealizeOperations.ps1 -sddcManagerFqdn sfo-vcf01.sfo.rainpole.io -sddcManagerUser administrator@vsphere.local -sddcManagerPass VMw@re1! -workbook F:\vvs\PnP.xlsx -filePath F:\vvs - This example performs the deployment and configuration of Aria Operations using the parameters provided within the Planning and Preparation Workbook -#> - -Param ( - [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerFqdn, - [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerUser, - [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerPass, - [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workbook, - [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$filePath -) - -# Define Reusable Parameters -$solutionName = "Intelligent Operations Management for VMware Cloud Foundation" -$operationsProductName = "Aria Operations" -$templatePath = (Get-InstalledModule -Name PowerValidatedSolutions).InstalledLocation + "\SampleNotifications\" -$templateFile = "vrops-vcf-notifications.csv" - -Clear-Host; Write-Host "" - -Start-SetupLogFile -Path $filePath -ScriptName $MyInvocation.MyCommand.Name -Write-LogMessage -Type INFO -Message "Starting the Process of Configuring of $operationsProductName Based on $solutionName" -Colour Yellow -Write-LogMessage -Type INFO -Message "Setting up the log file to path $logfile" -Write-LogMessage -Type INFO -Message "Setting the working directoy to path: $filePath" - -Try { - Write-LogMessage -Type INFO -Message "Checking Existance of Planning and Preparation Workbook: $workbook" - if (!(Test-Path $workbook )) { - Write-LogMessage -Type ERROR -Message "Unable to Find Planning and Preparation Workbook: $workbook, check details and try again" -Colour Red - Break - } else { - Write-LogMessage -Type INFO -Message "Found Planning and Preparation Workbook: $workbook" - } - Write-LogMessage -Type INFO -Message "Checking a Connection to SDDC Manager: $sddcManagerFqdn" - if (Test-VCFConnection -server $sddcManagerFqdn ) { - Write-LogMessage -Type INFO -Message "Attempting to connect to VMware Cloud Foundation to Gather System Details" - if (Test-VCFAuthentication -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass) { - Write-LogMessage -Type INFO -Message "Gathering Details from SDDC Manager Inventory and Extracting Worksheet Data from the Excel Workbook" - Write-LogMessage -type INFO -message "Opening the Excel Workbook: $Workbook" - $pnpWorkbook = Open-ExcelPackage -Path $Workbook - Write-LogMessage -type INFO -message "Checking Valid Planning and Preparation Workbook Provided" - if (($pnpWorkbook.Workbook.Names["vcf_version"].Value -ne "v4.4.x") -and ($pnpWorkbook.Workbook.Names["vcf_version"].Value -ne "v4.5.x") -and ($pnpWorkbook.Workbook.Names["vcf_version"].Value -ne "v5.0.x")) { - Write-LogMessage -type INFO -message "Planning and Preparation Workbook Provided Not Supported" -colour Red - Break - } else { - Write-LogMessage -type INFO -message "Supported Planning and Preparation Workbook Provided. Version: $(($pnpWorkbook.Workbook.Names["vcf_version"].Value))" -Colour Green - } - - $sddcDomainName = $pnpWorkbook.Workbook.Names["mgmt_sddc_domain"].Value - $sddcWldDomainName = $pnpWorkbook.Workbook.Names["wld_sddc_domain"].Value - $collectorGroupName = $pnpWorkbook.Workbook.Names["mgmt_sddc_domain"].Value + "-collector-group" - $defaultCollectorGroup = "Default collector group" - $vropsFqdn = $pnpWorkbook.Workbook.Names["xreg_vrops_virtual_fqdn"].Value - $vropsIpList = $pnpWorkbook.Workbook.Names["xreg_vrops_virtual_ip"].Value + "," + $pnpWorkbook.Workbook.Names["xreg_vrops_nodea_ip"].Value + "," + $pnpWorkbook.Workbook.Names["xreg_vrops_nodeb_ip"].Value + "," + $pnpWorkbook.Workbook.Names["xreg_vrops_nodec_ip"].Value - $vropsAdapterName = $pnpWorkbook.Workbook.Names["xreg_vrops_virtual_hostname"].Value - $vropsrcIpList = $pnpWorkbook.Workbook.Names["region_vropsca_ip"].Value + "," + $pnpWorkbook.Workbook.Names["region_vropscb_ip"].Value - $vropsrcAdapterName = $collectorGroupName - $healthPackSearchString = 'vmware-mpforsddchealth-' + '*' - $healthPackFile = ((Get-ChildItem -path ($filePath + "\" + $healthPackSearchString)) | Sort-Object)[-1].name - - $csvFile = ($templatePath + $templateFile) - if (!(Test-Path ($csvFile) )) { Write-LogMessage -Type ERROR -Message "Unable to Find Notification CSV File: $csvFile, check -filePath value provided and try again" -Colour Red; Break } else { Write-LogMessage -Type INFO -Message "Found Notification CSV File: $csvFile" } - - # Connect Aria Operations to the VI Workload Domains in the First VMware Cloud Foundation Instance - Write-LogMessage -Type INFO -Message "Connect $operationsProductName to the VI Workload Domains in the First VMware Cloud Foundation Instance" - $StatusMsg = Register-vROPSWorkloadDomain -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -domain $sddcWldDomainName -status ENABLED -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - - # Modify the vCenter Server Adapters for the First VMware Cloud Foundation Instance in Aria Operations - Write-LogMessage -Type INFO -Message "Modify the vCenter Server Adapters for the First VMware Cloud Foundation Instance in $operationsProductName" - $StatusMsg = Update-vROPSAdapterVcenter -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -collectorGroupName $collectorGroupName -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "Modifing the vCenter Server Adapters for the First VMware Cloud Foundation Instance: SUCCESSFUL" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message "Modifing the vCenter Server Adapters for the First VMware Cloud Foundation Instance, already modifed: SKIPPED" -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - - # Add NSX Manager Adapters in Aria Operations - Write-LogMessage -Type INFO -Message "Add NSX Manager Adapters in $operationsProductName" - $StatusMsg = Add-vROPSAdapterNsxt -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -domain $sddcDomainName -collectorGroupName $collectorGroupName -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - $StatusMsg = Add-vROPSAdapterNsxt -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -domain $sddcWldDomainName -collectorGroupName $collectorGroupName -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - - # Install the SDDC Health Monitoring Solution in Aria Operations - Write-LogMessage -Type INFO -Message "Install the SDDC Health Monitoring Solution in $operationsProductName" - $StatusMsg = Enable-vROPSManagementPack -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -packType "SDDC Health" -pakFile $healthPackFile -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - - # Rename the SDDC Health Adapters for the Aria Operations Analytics Cluster Nodes - Write-LogMessage -Type INFO -Message "Rename the SDDC Health Adapters for the $operationsProductName Analytics Cluster Nodes" - $StatusMsg = Update-vROPSAdapterSddcHealth -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "Renaming the SDDC Health Adapters for the '$operationsProductName': SUCCESSFUL" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message "Renaming the SDDC Health Adapters for the $operationsProductName, already performed: SKIPPED" -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - - # Add SDDC Health Adapters for the Aria Operations Collector Nodes - Write-LogMessage -Type INFO -Message "Add SDDC Health Adapters for the $operationsProductName Collector Nodes" - $StatusMsg = Add-vROPSAdapterSddcHealth -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "Adding Adapter (SDDC Health Adapter Instance) for Collectors to $operationsProductName ($vropsFqdn): SUCCESSFUL" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message "Adding Adapter (SDDC Health Adapter Instance) for Remore Collectors to $operationsProductName ($vropsFqdn), already performed: SKIPPED" -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - - # Activate the Ping Management Pack in Aria Operations - Write-LogMessage -Type INFO -Message "Activate the Ping Management Pack in $operationsProductName" - $StatusMsg = Register-vROPSManagementPack -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -state enable -packType Ping -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - - # Add Ping Adapters for the Aria Operations Nodes - Write-LogMessage -Type INFO -Message "Add Ping Adapters for the $operationsProductName Nodes" - $StatusMsg = Add-vROPSAdapterPing -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -addressList $vropsIpList -adapterName $vropsAdapterName -collectorGroupName $defaultCollectorGroup -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - $StatusMsg = Add-vROPSAdapterPing -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -addressList $vropsrcIpList -adapterName $vropsrcAdapterName -collectorGroupName $collectorGroupName -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - - # Create Notifications in Aria Operations for VMware Cloud Foundation Issues - Write-LogMessage -Type INFO -Message "Create Notifications in $operationsProductName for VMware Cloud Foundation Issues" - $StatusMsg = Import-vROPSNotification -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -csvPath ($filePath + "\" + $csvFile) -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - } - } -} Catch { - Debug-CatchWriter -object $_ -} - -Write-LogMessage -Type INFO -Message "Finishing the Process of Configuring of $operationsProductName Based on $solutionName" -Colour Yellow diff --git a/SampleScripts/iom/iomDeployAriaOperations.ps1 b/SampleScripts/iom/iomDeployAriaOperations.ps1 deleted file mode 100644 index a533a708..00000000 --- a/SampleScripts/iom/iomDeployAriaOperations.ps1 +++ /dev/null @@ -1,247 +0,0 @@ -# Copyright 2023 Broadcom. All Rights Reserved. -# SPDX-License-Identifier: BSD-2 - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -<# - .NOTES - =================================================================================================================== - Created by: Gary Blake - Senior Staff Solutions Architect - Creation Date: 2021-12-14 - =================================================================================================================== - - .CHANGELOG - - 1.0.001 (Gary Blake / 2022-02-16) - Added support for both VCF 4.3.x and VCF 4.4.x Planning and Prep Workbooks - - 1.1.000 (Gary Blake / 2022-10-04) - Added Support for VCF 4.5.x Planning and Prep Workbook - - 1.2.000 (Gary Blake / 2023-07-25) - Added Support for VCF 5.0.x Planning and Prep Workbook - - Removed Support for VCF 4.3.x Planning and Prep Workbook - - Improvements to message output - - 1.2.001 (Ryan Johnson / 2023-09-06) - Updated the product names for VMware Aria branding. - - Updated the script name for VMware Aria branding. - - =================================================================================================================== - - .SYNOPSIS - Deploys Aria Operations for Intelligent Operations Management. - - .DESCRIPTION - The iomDeployVrealizeOperations.ps1 provides a single script to deploy and configure Aria Operations - as defined by the Intelligent Operations Management for VMware Cloud Foundation validated solution. - - .EXAMPLE - iomDeployVrealizeOperations.ps1 -sddcManagerFqdn sfo-vcf01.sfo.rainpole.io -sddcManagerUser administrator@vsphere.local -sddcManagerPass VMw@re1! -workbook F:\vvs\PnP.xlsx -filePath F:\vvs - This example performs the deployment and configure of Aria Operations using the parameters provided within the Planning and Preparation Workbook. - - .EXAMPLE - iomDeployVrealizeOperations.ps1 -sddcManagerFqdn sfo-vcf01.sfo.rainpole.io -sddcManagerUser administrator@vsphere.local -sddcManagerPass VMw@re1! -workbook F:\vvs\PnP.xlsx -filePath F:\vvs -nested - This example performs a minimal footprint deployment and configuration of Aria Operations using the parameters provided within the Planning and Preparation Workbook. -#> - -Param ( - [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerFqdn, - [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerUser, - [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerPass, - [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workbook, - [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$filePath, - [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$nested -) - -# Define Reusable Parameters -$solutionName = "Intelligent Operations Management for VMware Cloud Foundation" -$operationsProductName = "Aria Operations" -$lcmProductName = "Aria Suite Lifecycle" - -Clear-Host; Write-Host "" - -Start-SetupLogFile -Path $filePath -ScriptName $MyInvocation.MyCommand.Name -Write-LogMessage -Type INFO -Message "Starting the Process of Deploying $operationsProductName Based on $solutionName" -Colour Yellow -Write-LogMessage -Type INFO -Message "Setting up the log file to path $logfile" -Write-LogMessage -Type INFO -Message "Setting the working directoy to path: $filePath" - -Try { - Write-LogMessage -Type INFO -Message "Checking Existance of Planning and Preparation Workbook: $workbook" - if (!(Test-Path $workbook )) { - Write-LogMessage -Type ERROR -Message "Unable to Find Planning and Preparation Workbook: $workbook, check details and try again" -Colour Red - Break - } else { - Write-LogMessage -Type INFO -Message "Found Planning and Preparation Workbook: $workbook" - } - Write-LogMessage -Type INFO -Message "Checking a Connection to SDDC Manager: $sddcManagerFqdn" - if (Test-VCFConnection -server $sddcManagerFqdn ) { - Write-LogMessage -Type INFO -Message "Attempting to connect to VMware Cloud Foundation to Gather System Details" - if (Test-VCFAuthentication -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass) { - Write-LogMessage -Type INFO -Message "Gathering Details from SDDC Manager Inventory and Extracting Worksheet Data from the Excel Workbook" - Write-LogMessage -type INFO -message "Opening the Excel Workbook: $Workbook" - $pnpWorkbook = Open-ExcelPackage -Path $Workbook - Write-LogMessage -type INFO -message "Checking Valid Planning and Preparation Workbook Provided" - if (($pnpWorkbook.Workbook.Names["vcf_version"].Value -ne "v4.4.x") -and ($pnpWorkbook.Workbook.Names["vcf_version"].Value -ne "v4.5.x") -and ($pnpWorkbook.Workbook.Names["vcf_version"].Value -ne "v5.0.x")) { - Write-LogMessage -type INFO -message "Planning and Preparation Workbook Provided Not Supported" -colour Red - Break - } else { - Write-LogMessage -type INFO -message "Supported Planning and Preparation Workbook Provided. Version: $(($pnpWorkbook.Workbook.Names["vcf_version"].Value))" -colour Green - } - - $sddcDomainName = $pnpWorkbook.Workbook.Names["mgmt_sddc_domain"].Value - $licenseAlias = if ($pnpWorkbook.Workbook.Names["vrs_license"].Value) { "Aria Suite" } else { "Aria Operations" } - $licenseKey = if ($pnpWorkbook.Workbook.Names["vrs_license"].Value) { $pnpWorkbook.Workbook.Names["vrs_license"].Value } else { $pnpWorkbook.Workbook.Names["vrops_license"].Value } - $certificateAlias = $pnpWorkbook.Workbook.Names["xreg_vrops_virtual_hostname"].Value - $rootPasswordAlias = $pnpWorkbook.Workbook.Names["xreg_vrops_root_password_alias"].Value - $rootPassword = $pnpWorkbook.Workbook.Names["xreg_vrops_root_password"].Value - $rootUserName = "root" - $xintPasswordAlias = $pnpWorkbook.Workbook.Names["vrslcm_xreg_env_password_alias"].Value - $xintPassword = $pnpWorkbook.Workbook.Names["vrslcm_xreg_env_password"].Value - $xintUserName = $pnpWorkbook.Workbook.Names["vrslcm_xreg_admin_username"].Value - $vropsFolder = $pnpWorkbook.Workbook.Names["xreg_vrops_vm_folder"].Value - $vropsrcFolder = $pnpWorkbook.Workbook.Names["region_vrops_collector_vm_folder"].Value - if (!$PsBoundParameters.ContainsKey("nested")) { - $vropsVmList = $pnpWorkbook.Workbook.Names["xreg_vrops_nodea_hostname"].Value + "," + $pnpWorkbook.Workbook.Names["xreg_vrops_nodeb_hostname"].Value + "," + $pnpWorkbook.Workbook.Names["xreg_vrops_nodec_hostname"].Value - } else { - $vropsVmList = $pnpWorkbook.Workbook.Names["xreg_vrops_nodea_hostname"].Value + "," + $pnpWorkbook.Workbook.Names["xreg_vrops_nodeb_hostname"].Value - } - $vropsrcVmList = $pnpWorkbook.Workbook.Names["region_vropsca_hostname"].Value + "," + $pnpWorkbook.Workbook.Names["region_vropscb_hostname"].Value - $vropsAntiAffinityRuleName = "anti-affinity-rule-vrops" - $vropsAntiAffinityVMs = $vropsVmList - $vropsrcAntiAffinityRuleName = "anti-affinity-rule-vropsrc" - $vropsrcAntiAffinityVMs = $vropsrcVmList - $ruleNameVrops = "vm-vm-rule-wsa-vrops" - $drsGroupNameVrops = $pnpWorkbook.Workbook.Names["xreg_vrops_vm_group_name"].Value - $drsGroupNameWsa = $pnpWorkbook.Workbook.Names["xreg_wsa_vm_group_name"].Value - $drsGroupVMsVrops = $vropsVmList - $ruleNameVropsrc = "vm-vm-rule-vrops-vropsrc" - $drsGroupNameVropsrc = $pnpWorkbook.Workbook.Names["region_vrops_collector_group_name"].Value - $drsGroupVMsVropsrc = $vropsrcVmList - $vmList = $pnpWorkbook.Workbook.Names["xreg_vrops_nodea_hostname"].Value + "," + $pnpWorkbook.Workbook.Names["xreg_vrops_nodeb_hostname"].Value + "," + $pnpWorkbook.Workbook.Names["xreg_vrops_nodec_hostname"].Value + "," + $pnpWorkbook.Workbook.Names["region_vropsca_hostname"].Value + "," + $pnpWorkbook.Workbook.Names["region_vropscb_hostname"].Value - $groupName = $pnpWorkbook.Workbook.Names["mgmt_cluster"].Value + "_primary-az-vmgroup" - $stretchedCluster = $pnpWorkbook.Workbook.Names["mgmt_stretched_cluster_chosen"].Value - $collectorGroupName = $pnpWorkbook.Workbook.Names["mgmt_sddc_domain"].Value + "-collect-group" - $currency = $pnpWorkbook.Workbook.Names["xreg_vrops_currency"].Value - $wsaFqdn = $pnpWorkbook.Workbook.Names["xreg_wsa_nodea_hostname"].Value + "." + $pnpWorkbook.Workbook.Names["parent_dns_zone"].Value - $wsaUser = $pnpWorkbook.Workbook.Names["local_admin_username"].Value - $wsaPass = $pnpWorkbook.Workbook.Names["local_admin_password"].Value - $domain = $pnpWorkbook.Workbook.Names["region_ad_child_fqdn"].Value - $bindUser = $pnpWorkbook.Workbook.Names["child_svc_wsa_ad_user"].Value - $bindPass = $pnpWorkbook.Workbook.Names["child_svc_wsa_ad_password"].Value - $baseDnGroup = $pnpWorkbook.Workbook.Names["child_ad_groups_ou"].Value - $adGroups = "$($pnpWorkbook.Workbook.Names["group_gg_vrops_admins"].Value)","$($pnpWorkbook.Workbook.Names["group_gg_vrops_content_admins"].Value)","$($pnpWorkbook.Workbook.Names["group_gg_vrops_read_only"].Value)" - $smtpServer = $pnpWorkbook.Workbook.Names["smtp_server"].Value - $smtpPort = $pnpWorkbook.Workbook.Names["smtp_server_port"].Value - $senderAddress = $pnpWorkbook.Workbook.Names["xreg_vrops_smtp_sender_email_address"].Value - $vropsAdminGroup = $pnpWorkbook.Workbook.Names["group_gg_vrops_admins"].Value - $vropsContentAdminGroup = $pnpWorkbook.Workbook.Names["group_gg_vrops_content_admins"].Value - $vropsReadOnlyGroup = $pnpWorkbook.Workbook.Names["group_gg_vrops_read_only"].Value - - $vropsPem = $certificateAlias + ".2.chain.pem" - if (!(Test-Path ($filePath + "\" + $vropsPem) )) { - Write-LogMessage -Type ERROR -Message "Unable to Find Certificate File: $vropsPem, check -filePath value provided and try again" -Colour Red; Break - } else { - Write-LogMessage -Type INFO -Message "Found Certificate File: $vropsPem" -colour Green - } - - # Add the Aria Operations License to Aria Suite Lifecycle - Write-LogMessage -Type INFO -Message "Add the $operationsProductName License to $lcmProductName" - $StatusMsg = New-vRSLCMLockerLicense -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -alias $licenseAlias -license $licenseKey -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - - # Import the Certificate for Aria Operations to Aria Suite Lifecycle - Write-LogMessage -Type INFO -Message "Import the Certificate for $operationsProductName to $lcmProductName" - $StatusMsg = Import-vRSLCMLockerCertificate -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -certificateAlias $certificateAlias -certChainPath ($filePath + "\" + $vropsPem) -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - - # Add the Aria Operations Password to Aria Suite Lifecycle - Write-LogMessage -Type INFO -Message "Add the $operationsProductName Password to $lcmProductName" - $StatusMsg = New-vRSLCMLockerPassword -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -alias $rootPasswordAlias -password $rootPassword -userName $rootUserName -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - $StatusMsg = New-vRSLCMLockerPassword -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -alias $xintPasswordAlias -password $xintPassword -userName $xintUserName -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - - # Deploy Aria Operations by Using Aria Suite Lifecycle - if (!$PsBoundParameters.ContainsKey("nested")) { - Write-LogMessage -Type INFO -Message "Deploy $operationsProductName Using $lcmProductName" - $StatusMsg = New-vROPSDeployment -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -workbook $workbook -monitor -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg -contains "FAILED" ) { Write-LogMessage -Type ERROR -Message "$StatusMsg"; Break } else { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta; $ErrorMsg = $null } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - } else { - Write-LogMessage -Type INFO -Message "Deploy $operationsProductName Using $lcmProductName" - $StatusMsg = New-vROPSDeployment -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -workbook $workbook -monitor -nested -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg -contains "FAILED" ) { Write-LogMessage -Type ERROR -Message "$StatusMsg"; Break } else { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta; $ErrorMsg = $null } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - } - - # Create Virtual Machine and Template Folders for the Aria Operations Virtual Machines - Write-LogMessage -Type INFO -Message "Create Virtual Machine and Template Folders for the $operationsProductName Appliances" - $StatusMsg = Add-VMFolder -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -domain $sddcDomainName -folderName $vropsFolder -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - $StatusMsg = Add-VMFolder -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -domain $sddcDomainName -folderName $vropsrcFolder -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - - # Move the Aria Operations Virtual Machines to the Dedicated Folders - Write-LogMessage -type INFO -Message "Move the $operationsProductName Appliances to the Dedicated Folders" - $StatusMsg = Move-VMtoFolder -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -domain $sddcDomainName -vmList $vropsVmList -folder $vropsFolder -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg -match "SUCCESSFUL") { Write-LogMessage -Type INFO -Message "Relocating $operationsProductName Cluster Appliances to Dedicated Folder: SUCCESSFUL" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - $StatusMsg = Move-VMtoFolder -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -domain $sddcDomainName -vmList $vropsrcVmList -folder $vropsrcFolder -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg -match "SUCCESSFUL") { Write-LogMessage -Type INFO -Message "Relocating $operationsProductName Collector Appliances to Dedicated Folder: SUCCESSFUL" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - - # Configure vSphere DRS Anti-Affinity Rules for the Aria Operations Virtual Machines - Write-LogMessage -Type INFO -Message "Configure vSphere DRS Anti-Affinity Rules for the $operationsProductName Appliances" - $StatusMsg = Add-AntiAffinityRule -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -domain $sddcDomainName -ruleName $vropsAntiAffinityRuleName -antiAffinityVMs $vropsAntiAffinityVMs -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - $StatusMsg = Add-AntiAffinityRule -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -domain $sddcDomainName -ruleName $vropsrcAntiAffinityRuleName -antiAffinityVMs $vropsrcAntiAffinityVMs -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - - # Create a VM Group and Define the Startup Order of the Aria Operations Analytics Cluster Virtual Machines - Write-LogMessage -Type INFO -Message "Create a VM Group and Define the Startup Order of the $operationsProductName Analytics Cluster Appliances" - $StatusMsg = Add-ClusterGroup -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -domain $sddcDomainName -drsGroupName $drsGroupNameVrops -drsGroupVMs $drsGroupVMsVrops -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - $StatusMsg = Add-VmStartupRule -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -domain $sddcDomainName -ruleName $ruleNameVrops -vmGroup $drsGroupNameVrops -dependOnVmGroup $drsGroupNameWsa -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - - # Create a VM Group and Define the Startup Order of the Aria Operations Remote Collector Virtual Machines - Write-LogMessage -Type INFO -Message "Create a VM Group and Define the Startup Order of the $operationsProductName Collector Appliances" - $StatusMsg = Add-ClusterGroup -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -domain $sddcDomainName -drsGroupName $drsGroupNameVropsrc -drsGroupVMs $drsGroupVMsVropsrc -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - $StatusMsg = Add-VmStartupRule -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -domain $sddcDomainName -ruleName $ruleNameVropsrc -vmGroup $drsGroupNameVropsrc -dependOnVmGroup $drsGroupNameVrops -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - - if ($stretchedCluster -eq "Include") { - # Add the Aria Operations Virtual Machines to the First Availability Zone VM Group - Write-LogMessage -Type INFO -Message "Add the $operationsProductName Appliances to the First Availability Zone VM Group" - $StatusMsg = Add-VmGroup -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -domain $sddcDomainName -name $groupName -vmList $vmList -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - } - - # Group the Aria Operations Collector Nodes - Write-LogMessage -Type INFO -Message "Group the $operationsProductName Collector Nodes" - $StatusMsg = Add-vROPSGroupRemoteCollectors -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -collectorGroupName $collectorGroupName -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - - # Synchronize the Active Directory Groups for Aria Operations in Workspace ONE Access - Write-LogMessage -Type INFO -Message "Synchronize the Active Directory Groups for $operationsProductName in Workspace ONE Access" - $StatusMsg = Add-WorkspaceOneDirectoryGroup -server $wsaFqdn -user $wsaUser -pass $wsaPass -domain $domain -bindUser $bindUser -bindPass $bindPass -baseDnGroup $baseDnGroup -adGroups $adGroups -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - - # Configure User Access in Aria Operations - Write-LogMessage -Type INFO -Message "Configure User Access in $operationsProductName" - $StatusMsg = Import-vROPSUserGroup -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -domain $domain -groupName $vropsAdminGroup -role Administrator -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - $StatusMsg = Import-vROPSUserGroup -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -domain $domain -groupName $vropsContentAdminGroup -role ContentAdmin -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - $StatusMsg = Import-vROPSUserGroup -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -domain $domain -groupName $vropsReadOnlyGroup -role ReadOnly -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - - # Set the Currency for Cost Calculation in Aria Operations - Write-LogMessage -Type INFO -Message "Set the Currency for Cost Calculation in $operationsProductName" - $StatusMsg = Add-vROPSCurrency -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -currency $currency -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - - # Configure Email Alert Plug-in Settings for Aria Operations - Write-LogMessage -Type INFO -Message "Configure Email Alert Plug-in Settings for $operationsProductName" - $StatusMsg = Add-vROPSAlertPluginEmail -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -pluginName "Email-Alert-Plugin" -smtpServer $smtpServer -smtpPort $smtpPort -senderAddress $senderAddress -secureConnection true -protocol TLS -authentication false -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg - if ( $StatusMsg ) { Write-LogMessage -Type INFO -Message "$StatusMsg" -Colour Green } if ( $WarnMsg ) { Write-LogMessage -Type WARNING -Message $WarnMsg -Colour Magenta } if ( $ErrorMsg ) { Write-LogMessage -Type ERROR -Message $ErrorMsg -Colour Red } - } - } -} Catch { - Debug-CatchWriter -object $_ -} - -Write-LogMessage -Type INFO -Message "Finishing the Process of Deploying $operationsProductName Based on $solutionName" -Colour Yellow