How to Force Delete a Stale Virtual Service in NSX ALB

Recently, I ran into an interesting problem in my lab where I couldn’t get rid of an unused Virtual Service in NSX ALB. The attempt to delete was failing with an error: “VS cannot be deleted! ‘It is being referred to by SystemConfiguration object”

I tried deleting the VS via API and it returned the same error

To figure out where this VS is being referenced, I looked through the pool members and other settings in NSX ALB, but I couldn’t discover anything particular. Internet searches were also not very helpful.

I then checked this issue in internal tools and got a hint that I needed to remove the VS reference from the system configuration through API first. 

The procedure to do so is given below.

1: Fetch NSX ALB System Configuration

In the response body of the above API call, you will get a reference to the DNS VS. Look for the field “dns_virtualservice_refs”

I have attached a sample response here just for reference.



2: Update NSX ALB System Configuration

Take the response output and change the dns_virtualservice_refs to blank. 

For an example payload, refer to the screenshot below.

Switch back to the NSX ALB UI and delete the VS. It should be deleted without any further hiccups.

I hope you enjoyed reading this post. Feel free to share this on social media if it is worth sharing.

Leave a Reply