Bulk Inventory Security Groups Creation using vRA + vRO + NSX-T REST API
Objective
Enable automated bulk creation of NSX-T Security Groups and VM membership assignment by uploading a .csv file through vRA catalog request.
This solution leverages:
-
vRA → For self-service catalog & request handling.
-
vRO → Workflow logic, parsing CSV, and REST API communication.
-
NSX-T REST API → To validate, create, and update Security Groups.
Input CSV Example
The CSV file contains the following columns:
SecurityGroupName,Criterion1,Criterion2
App-Frontend,VM.Name=web*,Tag=env:dev
App-Backend,VM.Name=app*,Tag=env:qa
DB-Servers,VM.Name=db*,Tag=env:prod
SecurityGroupName → Name of the NSX-T security group
Criterion1, Criterion2 → Membership conditions (VM
names, Tags, IPs, etc.)
Workflow Logic
-
vRA Catalog Request
-
User uploads CSV file with
GroupName,Criterion1,Criterion2. -
vRA triggers a vRO workflow via Event Subscription or custom catalog item.
-
-
vRO Workflow Steps
-
Parse CSV file (using
PropertiesorResourceElement). -
For each line:
-
Validate VM exists in NSX-T inventory via API.
-
Check if Security Group exists.
-
If yes → Add VM to the group with Criterion.
-
-
-
-
REST API Calls to NSX-T Manager
-
GET /api/v1/fabric/virtual-machines→ Validate VM in NSX inventory. -
GET /policy/api/v1/infra/domains/default/groups→ Validate existing groups. -
PATCH /policy/api/v1/infra/domains/default/groups/<groupName>→ Create/Update group with VM membership criteria.
-
-
Update Status to vRA
-
Return result summary:
-
✅ Groups created
-
✅ VMs added
-
❌ Any VM not found
Process Flow Diagram
Benefits
- Bulk Automation: No manual clicks in NSX-T Manager.
- Consistency: Security groups are created and updated following policy standards.
- Scalability: Handle large CSV input (hundreds of VMs/groups).
- Integration: Single-click request from vRA catalog.
Solution Approach
We’ll build a vRO workflow that:
- Reads
the CSV input file.
- Iterates
through each row.
- Prepares
a REST API JSON payload for the NSX-T Security Group.
- Calls
the NSX-T Policy API to create the Security Group with its
criteria.
- Logs
the success/failure of each creation.

Comments
Post a Comment