Windows Virtual Machine
Execute
- sysprep /oobe /generalize /shutdown
The virtual machine will shutdown after generalize the vm
Linux Virtual Machine
Make sure you have install Azure Virtual Machine agent (VM agent)
On red hat distro,
# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
# rpm -ivh epel-release-7-5.noarch.rpm
# sudo yum install WALinuxAgent
# sudo systemctl enable waagent.service
Execute
- waagent -deprovision
Shutdown virtual machine and upload the virtual machine.