Solved this issue.
But registerAgentVm a VM as agent is not restarting the agent VM on "Exit Maintenance".
Does ManuallyProvisioned agent behave similar to the auto deployed?
if not, what changes are required to make a agent start on "Exit Maintenance"?