Wednesday Tidbit: PowerShell’s Import-PFXCertificate Removes the Private Key

I’ve been working on a complex automation solution recently in lab, and one task was to import a certificate to be used by VMware Horizon.

Those familiar with Horizon will know that any certificate used will need to have its corresponding private key which will also need to be exportable. The certificate also needs to have a friendly name of “vdm”.

My face when I figured out what was happening

All of the above is perfectly achievable in PowerShell, which is my chosen scripting language of choice for this task.

It appears that when my script was run as LocalSystem, the certificate and key were successfully imported – but the private key was immediately deleted. Anyone viewing the certificate in the Certificates MMC snapin would be blissfully unaware of this “feature”:

Yup… all good here!

However, post-script I began to notice problems. Some Horizon services would start but not all of them. The HTML and Flex admin pages became unavailable, complaining about protocol errors.

The Solution

To get around this I modified my script so that PowerShell used the certutil command instead of Import-PFXCertificate.

To successfully import the certificate and key, and set the friendly name, I use the following:

Documenting vRealize Orchestrator Code with JSDoc and Confluence

Recently I’ve been working on improving HobbitCloud’s DevOps practices, specifically around committing code to version control and documenting it. Once a developer checks code in, this should compile, and if successful be deployed to the test environment. Once here it will undergo automated testing before progressing to staging for unit and integration tests. Continue reading

Wednesday Tidbit: Cycling through XML in vRealize Orchestrator

A few months ago a client asked me to create an NSX application load-balancer programmatically, and then make it available to their vRealize Automation consumers in through the self-service catalog. In building-block fashion, they requested that this wasn’t a composite blueprint, but rather through XaaS. While the former would definitely take less time, the latter was not that difficult either once I got started. Continue reading