Summary
This integration script between vRealize Network Insight (vRNI) and VMware HCX, allows you to streamline the application migration process.
First, use the application discovery methods within vRNI to discover the application boundaries, including the VMs (or other workloads), to form application constructs within vRNI. This integration script then synchronizes the vRNI application constructs into HCX Mobility Groups, saving you the time that it would've taken to do this manually. After the sync, you can pick up the migration process and execute the migration.
Requirements
Requirements
- Before running this integration script, make sure both vRealize Network Insight and HCX are licensed with Enterprise licenses.
- You will also need PowerShell version 6.2 or higher. PowerShell 7+ is preferred.
- PowervRNI and the PowerCLI HCX (specifically, VMware.VimAutomation.Hcx) module are also required.
Instructions
vRealize Network Insight and VMware HCX Integration
Summary
This integration script between vRealize Network Insight (vRNI) and VMware HCX, allows you to streamline the application migration process.
First, use the application discovery methods within vRNI to discover the application boundaries, including the VMs (or other workloads), to form application constructs within vRNI. This integration script then synchronizes the vRNI application constructs into HCX Mobility Groups, saving you the time that it would've taken to do this manually. After the sync, you can pick up the migration process and execute the migration.
Requirements
- Before running this integration script, make sure both vRealize Network Insight and HCX are licensed with Enterprise licenses.
- You will also need PowerShell version 6.2 or higher. PowerShell 7+ is preferred.
- PowervRNI and the PowerCLI HCX module are also required.
Instructions
Running the integration script is straight-forward, you can find the usage and parameters of the script below.
Usage
./sync-vrni-to-hcx.ps1
Parameters
- -HCX_Server
HCX Connector appliance hostname or IP address. - -HCX_Username
HCX Connector appliance username used to login with. - -HCX_Password
HCX Connector appliance password used to login with. - -HCX_DestinationVC
Hostname of the destination vCenter to create the Mobility Groups for, as it is registered inside HCX. - -HCX_DestinationCloud
Hostname of the destination HCX Cloud appliance to create the Mobility Groups in. - -Sync_Applications
Optional array of application names to limit the sync with. This is an optional paramater and should be formatted like this:
-Sync_Applications ("MyApp1", "MyApp2", "..")
When omitted, the sync will occur for all available applications.
vRNI Authentication
This script can be run against vRealize Network Insight and vRealize Network Insight Cloud. Each have different authentication methods, and there are different parameters to use:
vRNI Cloud
To use vRNI Cloud, only the -vRNI_Cloud_API_Token parameter is required. This will be the VMware Cloud Services Portal (CSP) Refresh token, which you can generate under "My Account" in CSP.
vRNI on-prem
For vRNI on-prem, the following (self-explanatory) parameters are required:
-vRNI_Server your-platform-appliance -vRNI_Username myusername -vRNI_Password mypassword
Examples
Synchronising all vRNI applications
./sync-vrni-to-hcx.ps1 -vRNI_Server vrni.lab -vRNI_Username admin@local -vRNI_Password admin -HCX_Server hcxconnector.lab -HCX_Username hcx@vsphere.local -HCX_Password 'VMware1!' -HCX_DestinationVC dst-vc.lab -HCX_DestinationCloud hcxcloud.lab
[03-05-2020_05:19:59] Connecting to vRealize Network Insight..[03-05-2020_05:20:01] Retrieving all applications..
[03-05-2020_05:20:20] Found application: 'onprem_imagic' with 6 VMs
[03-05-2020_05:20:22] Found application: '3TierApp02' with 1 VMs
[03-05-2020_05:20:25] Found application: 'HIVE Training' with 1 VMs[03-05-2020_05:20:27] Found application: 'VDI Pool 1' with 8 VMs
[03-05-2020_05:20:29] Found application: 'app_mcclanahanc' with 2 VMs
[03-05-2020_05:20:31] Found application: 'Top-Video' with 15 VMs[03-05-2020_05:20:33] Found application: 'F5-3TierApp05' with 5 VMs
[03-05-2020_05:20:34] Connecting to VMware HCX..
[03-05-2020_05:20:48] Created Mobility Group: 'onprem_imagic_2020-03-05'
[03-05-2020_05:20:49] Created Mobility Group: '3TierApp02_2020-03-05'
[03-05-2020_05:20:50] Created Mobility Group: 'HIVE Training_2020-03-05'
[03-05-2020_05:20:51] Created Mobility Group: 'VDI Pool 1_2020-03-05'
[03-05-2020_05:20:52] Created Mobility Group: 'app_mcclanahanc_2020-03-05'
[03-05-2020_05:20:53] Created Mobility Group: 'Top-Video_2020-03-05'
[03-05-2020_05:20:54] Created Mobility Group: 'F5-3TierApp05_2020-03-05'
Synchronising selective vRNI applications:
./sync-vrni-to-hcx.ps1 -vRNI_Server vrni.lab -vRNI_Username admin@local -vRNI_Password admin -HCX_Server hcxconnector.lab -HCX_Username hcx@vsphere.local -HCX_Password 'VMware1!' -HCX_DestinationVC dst-vc.lab -HCX_DestinationCloud hcxcloud.lab -Sync_Applications ("app_hcx-3tierapp", "Top-Video")
Synchronising from vRNI Cloud
./sync-vrni-to-hcx.ps1 -vRNI_Cloud_API_Token 'xxx-xxx' -HCX_Server hcxconnector.lab -HCX_Username hcx@vsphere.local -HCX_Password 'VMware1!' -HCX_DestinationVC dst-vc.lab -HCX_DestinationCloud hcxcloud.lab
Installation
This PowerShell script requires at a minimum PowerShell version 6.2. Beyond that, it also needs the modules VMware.VimAutomation.Hcx version 11.5+ and PowervRNI version 1.8+. These are the steps to get up and running:
1. Download the vRealize Network Insight and HCX Integration fling.
2. Open PowerShell and execute the following:
3. PS > Install-Module VMware.VimAutomation.Hcx
4. PS > Install-Module PowervRNI
5. PS > Get-Help ./sync-vrni-to-hcx.ps1
6. You can now run the sync-vrni-to-hcx.ps1 script.
Contributors
Similar Flings

vRealize Network Insight Toolkit
Kickstart automation with vRealize Network Insight with the toolkit! This appliance-based Fling deploys right next to your vRealize Network Insight deployment.