Skip to content

Remove Managed Machine in vRA 8

In vRA 7 you could remove a VM from portal management (leaving the VM in vCenter) by using the “Unregister” day 2 action. There is no such action in vRA 8. There is also no way to remove the VM using the API without it being deleted from vCenter.

Fortunately there is a way but it involves directly editing data within the postgres database in the postgres pod.

Accessing the postgres kubernetes pod and directly editing the postgres databases is not supported by VMware.
VM can be seen in the portal

1) Connect to the vRA 8 VM (console or SSH)

Run the below command to see all pods:
kubectl get --all-namespaces pods

You will see a pod named “postgres-0” under namespace “prelude”

Run the below command to get a bash shell on the postgres pod:
kubectl exec --namespace prelude -it postgres-0 -- /bin/bash

Run the below command to change to the “postgres” user:
su postgres

Run the below command to connect to the “catalog-db” postgres database:
psql catalog-db

Run the below postgres query to remove VM from vRA 8 management:
delete from dep_resource where name = '{vmName}';

Disconnect from postgres using the \q command and disconnect from the vRA 8 VM.

VM will have disappeared from deployment, leaving an orphaned blueprint which can be deleted

VM can be seen removed from the portal
Published invRealize Automation

12 Comments

  1. Brent Brent

    Compute resource remains managed. Why not add it to the cloud client or API etc as supported feature?

    I could see this a huge benefit if you do large onboarding and selected the wrong deployment and want to remap it to the correct locations.

  2. Worked a treat, thank you!

    • luke luke

      Hi Gary

      Thanks for your comment. I am glad it helped you out 🙂

      Cheers, Luke

  3. Mukesh Mukesh

    Hi Luke,
    I tried using this blog to see if it works for my environment. I see a Machine when looked from Infrastructure – resource – Machines, which doesn’t exist in vCenter, so I tried going to the dep-resource table and did select to see if its exits, I got zero rows for the query, am I missing anything here?

    Look foward to hearing from you.

    Thanks

    • luke luke

      Hi Mukesh

      Thanks for your comment.

      Do you have any VMs in vRA? If so they should be in the “dep-resource” table, what query were you running. If a VM exists in vRA but not vCenter it will be orphaned, does it show this status when looking under Infrastructure?

      Cheers, Luke

  4. Alexey Alexey

    Luke, doing this will only remove the parent deployment container and not unmanage the machine. The actual compute resource remains managed but with broken dependencies (becoming orphans), you can’t easily repair. There are way more things you need to do to it right in the Cloud Assembly. Please consider revising your approach.

    • luke luke

      Hi Alexey

      Thanks for taking your time to comment.

      Hmmm ok interesting as it seemed to do the trick for my needs. I do know that editing the postgres directly has always been unsupported by VMware.

      Out of interest is there a correct way to unmanage a VM in vRA 8 without having it deleted from vCenter?

      Cheers, Luke

      • Alexey Alexey

        A bit late to respond to your question, Luke. As of today, vRA doesn’t officially support «unmanaging» machines, either provisioned or onboarded. If this is an unavoidable approach, I would recommend reaching out to VMware support for help.

  5. xian xian

    In the screenshot you have “delete from”, in the text “drop from”

    • luke luke

      Sorry typo, it should be “delete from”. I have edited the post. Thanks for letting me know 🙂

      • Michael Maréchal Michael Maréchal

        Just be aware that this is not supported by VMware and if you’re looking at adding the VMs back to any projects, they will be unavailable for discovery in the onboarding process.

        • luke luke

          Hi Michael

          Thanks for taking the time to comment.

          Yes this method is not supported by VMware but sometimes doing unsupported actions is required 😉

          As far as I know unmanaging a provisioned or onboarded VM is still not possible via a VMware supported method. I still need to spend more time with vRA 8.1 and 8.2 to see if the API can be used to unmanage a VM.

          Cheers, Luke

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.