***UPDATE*** The download link is currently broken. I seem to have lost the file, will fix the link as soon as I find or recreate it. Sorry about that. 😦
In part 1 of this series, we created a list of security groups and displayed that list to users during the request. In this post, we want to enhance that functionality by adding these features.
- Creation of Security Groups and inclusion in Dropdown lists
- Add a VM to a Security Group post-provisioning
- Import existing Security Groups into vRA inventory
- Add a Security Group to a Dropdown list
We’re going to do that by importing a vCO package with some new workflows and actions, then link up the workflows to Advanced Services and Resource Actions. As before, we’ll require the NSX and vCAC/vRA plugins for Orchestrator.
Preparation
- Complete the creation of the VCNS.SecurityGroup.Names.production property dictionary and valuelist attribute from Part 1. We’re going to reuse those items. so make a note of the exact name of the property dictionary and the valuelist attribute. In my case, I’ve named the Property Dictionary VCNS.SecurityGroup.Names.production and also named the valuelist attribute for it VCNS.SecurityGroup.Names.production
- Make sure vRA Advanced Services Server Configuration is complete and test the connection to the Orchestrator server. The default, built-in VCO is fine.
- Login to vCO client as a vCO Admin. Set the mode to “Design” and navigate to the Inventory tab. Make sure that you have a connection listed under “vCAC Infrastructure Administration” and a connection listed under “NSX”.

Get the Package
I’ve put together a handful of workflows and actions that use or expand the NSX plugin to provide information of functionallity back to vRA. Where possible, I reused existing library workflows, but in some cases, I had to use the API to create a REST call and consume that in an action.
By downloading any code, package or file, you acknowledge that:
There is no explicit or implied warranty or support for the code. Neither Brian Ragazzi, his employer nor anyone else is responsible for any problems, errors, omissions, unexpected behavior, breakage, trauma, outage, fatigue, lost time, lost work or incontinence that may occur as a result of using the code or package.
Download the zip file. It contains the package and a couple of images that can be used for the advanced services
Import the Package
- Extract the zip file
- In the vCO Client, navigate to the packages tab.
- Click the “import package” button and select the extracted .package file
- On the Package Import Information step, click “Import”
- On the Import package… step, check the “Select/Deselect all” box to check all of the items. Please note the server path, these should not be duplicates of anything else you have in your vCO inventory (unless you’ve already imported this package previously). Click “Import Selected elements”.
- Review the workflows and actions added to your inventory.
Configure Advanced Services – Create Security Group
This service enables the user to create a new NSX Security Group and automatically adds its name to the appropriate dropdown list of security groups. It can be added once for each different list of security groups. You’ll need to know the exact name of the Property Dictionary and valuelist attribute you created in Part 1.


- While logged into vRA as a service architect, navigate to the Advanced Services tab, click “Custom Resources“
- We need to make vRA aware of NSX Security Groups. Click the Add button.
- In the Orchestrator Type field, enter “NSX:SecurityGroup“; for the Name, I suggest “NSX Security Group“, click Next
- On the details form, we’re not going to make any changes, but if you wanted to hide certain properties, you could here. Click “Add“.
- Click “Service Blueprints”, then the “Add” button.
- On the Workflow tab, select the AddNewSecurityGrouptoDropdown workflow, click next.
- On the Details tab, set the name to something like “Create new Production NSX Security Group“, because we’re going to create the security group and add its name to the “production”dropdown list. Click Next.
- On the Blueprint Form tab, under the “Step” Form page (default), mouseover the text field labelled “Name of Custom Property Dictionary in vCAC/vRA”. Click the pencil “edit” icon when it appears.
- Click the Constraints tab of the “Edit Form Field” window. On the Value field, select “Constant” and enter “VCNS.SecurityGroup.Names.Production” (or whatever suffix you used) for the Property Dictionary. Set the Visible value to “No” so it doesn’t show up. Click Submit on the Edit Form Field window.
- Using the same method, set the Name of the Attribute appropriately and its visibility to no
- Edit the “Value to be appended to the ValueList attribute” field. Set the label to “New Security Group Name“. Do not set a value or make this one invisible, we need the user to enter a value, submit to save.
- Edit the vCACIaaSHost field – using the Constraints tab again– when setting the value, choose constant, then click Add by the green plus, to display a treeview, where you can choose your connection to the IaaS Server. Visible: No, submit to save.
- Edit the “NSX endpoint” field in the same way, selecting the NSX connection.
- When done, all fields except “New Security Group Name” will have a value. Click Next.
- On the Provisioned Resource tab, select “securityGroup [NSX Security Group]“. Click Add to save the service blueprint.
- Repeat steps 5-15 for any other dropdown lists containing security groups; say “Non-Production” for instance
- Highlight the Service Blueprint and click “Publish” to make the blueprint available for entitlements
- Navigate to Administration, Services.
- Add a new Service named “NSX Management” (for example) – I included a nifty image in the zip file
- Under Catalog Items, click the “Create new Production NSX Security Group” item to edit it.
- The Catalog item should inherit the Security Group icon from vCO, set its Service to “NSX Management”,click update to save.
- Create or Edit an entitlement to include the new Service and/or catalog item.
- Try it out, confirm that the Security Group was created in NSX, is visible in vCAC items and it name was added to the Property Dictionary
Configure Advanced Services – Import Security Group
This service allows you to make existing security groups visible as items in the vCAC Items view. Once this is done, we’ll add actions that allow you to add the security group to a dropdown list.
- Click “Service Blueprints”, then the “Add” button.
- Select the “GetNSXSecurityGroup” workflow, click Next
- On the details tab, set the name to “Import NSX Security Group“, click Next
- On the Blueprint form, set the “connection” to the NSX connection in vCO, then hide the field. Security Group Name will be a dropdown list of existing NSX Security Groups for the user to choose from. Click Next
- On the Provisioned Resource tab, select “securityGroup [NSX Security Group]“. Click Add to save the service blueprint.
- Just as before, publish the service blueprint, add it to a service and an entitlement.
Configure Advanced Services – Add Security Group to Dropdown list
With this service, we’ll let the user add the name of an existing Security Group to a drop down list. Unlike the first two, this is implemented as a Resource Action, meaning it’ll be executed against an existing item (a Security Group in this case)
- Under Resource Actions, click “Add”
- For the Workflow, select the “AddExistingSecurityGrouptoDropdown“, click Next
- On the “Input Resource” tab, keep NSX Security Group, click Next
- On the Details tab, set the Name to “Add Security Group to Production list” or similar, set the description, leave the Type options unchecked. click Next
- On the Form tab, just like the first service blueprint, set the Property Dictionary and Attribute names as appropriate. VCNS.SecurityGroup.Names.production in my example, set visible to no on both.
- Again, we’ll set the vCACIaaSHost to the connection to the Server and hide the field
- Click Add to save the action.
- Repeat steps 1-6 for each security group dropdown list (say “non-production” for instance)
- Publish the action and add it to an entitlement
- Test by navigating toNSX under Items, highlight a Security group and Select “Add Security Group to…” from the Actions menu.
Configure Advanced Services – Add VM to a Security Group
This service lets you add a provisioned VM to additional Security Groups. So, at provisioning-time, the VM is added to the Security Group selected by the user, but we may need to refine the security by adding that VM to additional Security Groups.
- Under Resource Actions, click “Add“
- For the Workflow, select the “AddVMtoSecurityGroup“, click Next
- On the “Input Resource” tab, keep IaaS VC VirtualMachine, click Next
- On the Details tab, set the name to “Add VM to a Security Group“, click Next
- On the Form tab, set the connection Value to the NSX connection.
- Leave the NSX Security Group field visible, click Add to save the action
- Publish the action and add it to an entitlement
- Test by selecting a machine under Items and “Add VM to a Security Group” from the Actions menu
- You’ll be presented with the list of allNSX Security Groups to which you can add the selected VM
Conclusion
This part of the series should help streamline the management of VMs and their membership in Security Groups. Obviously, items like removing a VM from a Security Group or even removing a Security Group are not included here. The NSX plugin is missing quite a bit of functionality available in the API, so those additional functions require significantly more configuration.
Thanks to John Dias for his information and examples posted here.