After completing the VMware Cloud Foundation (VCF) Workload Domain Import workflow, I realized it would be helpful to be able to view the pre-check validations outside of the VCF Operations UI, especially if there are multiple pre-checks that have failed.

While the VCF Operations UI provides a good overview of all pre-checks, it does not provide any filtering or sorting, so you have to skim scroll through the entire list (55 in my case) to see which ones failed. For each failed validation, you can get more details including the recommended remediation, but you need to expand each section which can be painstaking if you have more than a few failures.
This is where we can leverage the power of automation and the VCF APIs ...
The VCF Import functionality is provided by the SDDC Manager component and we will be using the the following two APIs (here and here). To demonstrate this functionality, I have created a few functions that you can access by downloading VCFImportFunctions.ps1.
Step 1 - Download VCFImportFunctions.ps1 and run the following command once to "source" the functions:
. ./VCFImportFunctions.ps1
Step 2 - Update the following variables which should be self-explanatory and then run the New-VCFImportValidation function which will initiate the validation pre-check for selected vCenter Server and it should return a task ID to be used in the next step:
$VCSAFQDN = "vc02.vcf.lab" $VCSASSOUsername = "*protected email*" $VCSASSOPassword = "VMware1!VMware1!" $VCSARootPassword = "VMware1!VMware1!" $SddcManagerFQDN = "sddcm01.vcf.lab" New-VCFImportValidation -VCSAFQDN $VCSAFQDN -SddcManagerFQDN $SddcManagerFQDN -VCSASSOUsername $VCSASSOUsername -VCSASSOPassword $VCSASSOPassword -VCSARootPassword $VCSARootPassword
Step 3 - Run the Get-VCFImportValidation function along with the required inputs including the task ID from the previous step to retrieve a report of the validations:
Get-VCFImportValidation -VCSAFQDN $VCSAFQDN -SddcManagerFQDN $SddcManagerFQDN -VCSASSOUsername $VCSASSOUsername -VCSASSOPassword $VCSASSOPassword -VCSARootPassword $VCSARootPassword -TaskId "2b030677-6c21-44e1-8a5f-a9fa1aaf8bd4"
By default, the output will only display validations that have failed as shown in the screenshot below.
You will find four columns of output: Status, ImportanceLevel, RemediationMessage and Message (which is what you see in VCF Operations UI).
Some of the remediation messages can be quite long, so you can easily export the report into a CSV file by simply piping the output to Export-Csv cmdlet as shown in the example below:
Get-VCFImportValidation -VCSAFQDN $VCSAFQDN -SddcManagerFQDN $SddcManagerFQDN -VCSASSOUsername $VCSASSOUsername -VCSASSOPassword $VCSASSOPassword -VCSARootPassword $VCSARootPassword -TaskId "2b030677-6c21-44e1-8a5f-a9fa1aaf8bd4" | Export-Csv -Path vc02.vcf.lab.csv
The really cool thing about this is you can easily pre-check all desired vCenter Server and/or NSX Manager to ensure that when you go and perform the operation, it will be successful or better yet, you can simply automate the entire workflow using SDDC Manager APIs.
Note: The function currently only implements the pre-check validation for existing vCenter Server. If you have an existing NSX Manager, you will need to extend the functions to include the required NSX specification for validating that component as well.
Lastly, if you would like to view all pre-check validations both successful and/or failed, you can add -FailedValidationsOnly and set that to $false to view the full output, which is the default behavior when performing the validation using VCF Operations UI.
Get-VCFImportValidation -VCSAFQDN $VCSAFQDN -SddcManagerFQDN $SddcManagerFQDN -VCSASSOUsername $VCSASSOUsername -VCSASSOPassword $VCSASSOPassword -VCSARootPassword $VCSARootPassword -TaskId "2b030677-6c21-44e1-8a5f-a9fa1aaf8bd4" -FailedValidationsOnly $falase
Thanks for the comment!