Automated deployment of vRealize Automation 8.x via PowerShell – Part 2
If all went well during Part 1, you should now have a fresh vRSLCM installation.
In this part I will use another script to take care of configuring vRSLCM, deploying VIDM and deploying vRA, both as single node. Just like the previous script, some parts of the script may be further optimized and need additional error handling. Also, I did not include any choices in the current script, so you must comment out parts you don’t want to use.
The biggest struggle I had creating this script, was generating, and using the correct JSON code. As you notice in the script, I have used two different methods to handle JSON. The scriptpart below creates key value pairs and then converts them to JSON.
$data=@{
alias="$vCenterServer"
password="$vCenterPassword"
passwordDescription="vCenter vcsamgmt admin password"
userName="$vCenterAccount"
}| ConvertTo-Json
For larger and more complex JSON input, I ran into all kinds of trouble and decided to use native JSON and “convert” that to powershell usable code. The major drawback of this method is that you must put a backquote/backtick ` character as escape character which makes it error prone. My suggestion is to play around with some JSON files and get more comfortable with PowerShell cmdlets like ConvertTo-Json and ConvertFrom-Json
$certificateData = "{
`"alias`": `"vRealizeWildcard`",
`"certificateChain`": `"$FlatPublicCert`",
`"passphrase`": `"`",
`"privateKey`": `"$FlatPrivateCert`"
}"
If you run the above script part and request the value of the $certificateData variable, it should return valid JSON output like this.
{
"alias": "vRealizeWildcard",
"certificateChain": "",
"passphrase": "",
"privateKey": ""
}
Another option is to create your JSON file with MS VisualStudo Code, Notepad++ or an online JSON Code validator like JSONLint. If you have a valid JSON file, you can always import the contents and convert it to JSON with powershell.
On to the script!
First have a look at the configuration variables and change them to reflect your own environment variables. I have put comments behind most of the lines for explanation. I suggest to take a snapshot of vRSLCM before running the script, so you can always Revert and try the script again.
In outline the script then does the following:
- Change the initial/default vRSLCM admin@local password and create an authentication header with the new password.
- Connect to vCenter to get the Folder ID of the VM Folder where you want to deploy your VM’s.
- You may decide to set the variable $deployVmFolderName to “”. In that case you can comment out the script part “Connect to vCenter to get VM Folder Id” You can just put a # in front of each line, or comment out a whole block by putting it between <# #>
- Create Account entries for vCenter and a default product account in the vRSLCM Locker.
- Create vRSLCM Datacenter and add vCenter to it.
- Add DNS and NTP Servers.
- I have added two DNS servers by running the same scriptblock. If you only have 1 DNS server comment out this part (#Add DNS Server 2). There might be a better way to do this, but I’ll save that for later.
- Add a License in the vRSLCM Locker.
- Create a new and/or import an existing Certificate.
- For my own environment I have created a wildcard certificate that I wanted to import into the Locker. If you don’t want to import a certificate, set the variable $importCert to $false.
- I you choose not to import a certificate, a new wildcard certificate will be created.
- Import/download the vidm.ova and vra.ova file from an NFS share to vRSLCM.
- Create vRSLCM globalenvironment and deploy single node VIDM instance
- Create vRSLCM “product” environment and deploy single node vRA instance.
You can download the latest version of the script “vRSLCM-Configure.ps1” from my [Github] repository.
Additional information
- API Browserver for 8.4
- API Documentation for 8.4 in PDF format
- JSON specs to deploy vRealize Suite Products using vRSLCM 8.0 – VMware KB75255.
Hi,
thanks for your great work!
Where can I find the soecifications for the product specific JSON-Paramters (vRops , vRA and vRO)?
Example: Is the isUpgradeVmCompatibility switch akso for vRops and vRA Available?
Best wishes
Markus
I could not find all the product specific JSON Parameters except for what is described in https://kb.vmware.com/s/article/75255
I got my parameters with reverse engineering; Deploy vRealize products and Export the configuration as JSON afterwards.
Thanks for your update on my github repo as well. Hope to get this updated soon.