Recently I have been having some fun and games with vRA 8.2, in particular, with the extensibility capabilities. With the introduction of PowerShell support for vRA actions, I thought I would have a little play and see what I could break.
I’m On A MetaData Hunt..
Ok, so first things first. I really hope that whoever is reading this can tell me what I have done wrong! There are examples from other great bloggers out there, showing you how to get information from the metadata, in NODE.JS. In my case, I specifically wanted to obtain the ‘userName’ of the requester. If you look at the screenshot below, part of the metadata section is shown. With PowerShell, I can never get any data out of it. Metadata is always empty. Answers on a postcard if anyone has any please!
Property Fun – Add A New Property During An Action Flow Sequence
Something that can be quite handy, is using the Flow type of action. This enables you to chain multiple actions together. You can pass output from one action to another by updating values. What you may not realise at first is that you can also add new properties to the payload with a value, use it in the next action, and then remove it so that there is no ‘secret data’ left over on the deployed resource properties.
The $payload that is injected into the function contains all the information and properties as of the time of the subscribed event. I create a new object, copy all of the payload to it. I then pass the new payload, stored as $outputs to the Add-Member PowerShell function. I add a new property called ‘Testing’ and set a value on it of ‘Michael.’ Finally I return the $outputs, sending this object as an output that will be used as the payload into the next action in the flow.
In the second action, I again take the $payload and make a new object and copy all of its properties and values. To prove that the previous actions output contains the new ‘Testing’ property, I write out the value to the console [log].
Finally, I remove the property from my $outputs object and return it. When the blueprint is requested, following the action executions, you can clearly see out new property ‘Testing’ printed out to the screen.
Looking at the properties on the deployed resource once deployment is complete, shows that the property is not shown.