I am working towards my first capture of a Linux Azure VM using the capture tool.

The first step is to run sudo waagent –deprovision. Running this command does the following:

  1. Removes SSH host keys (if Provisioning.RegenerateSshHostKeyPair is 'y' in the configuration file)

Does this mean that my private/public keys will be gone and my existing server will no longer be able to SSH into it's peers without copying these keys back in place?

  1. Clears nameserver configuration in /etc/resolv.conf

I believe my custom defined DNS names will have to be put back in place as well.

  1. Removes the root user's password from /etc/shadow (if Provisioning.DeleteRootPassword is 'y' in the configuration file)

Not familiar with /etc/shadow. Will I no longer have SSH access to my server?

  1. Removes cached DHCP client leases

I'm assuming this is harmless.

  1. Resets host name to localhost.localdomain

I believe this is only an issue if a custom hostname was setup.

  1. Deletes the last provisioned user account (obtained from /var/lib/waagent) and associated data

Is this an account being provisioned by the capture tool itself or by me? If latter, why so?


In order to answer your question, you need to understand why you execute command sudo waagent –deprovision.

There are two types images: Generalized and Specialized.

For a Generalized image, you should execute sudo waagent –deprovision, the commands removes all your personal account information, among other things, and prepares the machine to be used as an image. But it does not affect your data stored on your VM, only remove things that you mentioned. You could use Generalized image to deploy multiple VMs. The command's function is like Windows command Sysprep.

For a Specialized images, on ARM mode, you only need copy VM's VHD to other storage account and use the VHD to re-create a new VM. You don't lose any data on the VM. But you could use the image to deploy one VM. So, if you want to use your VM's VHD to deploy multiple VMs, you need to execute sudo waagent –deprovision.

I see that CtrlDot has answered your question, but I want to add it that, if you want to backup your VM, I suggest you could use Azure Backup Service. Capture VM could only backup once, if you want to backup your VM everyday or weekly, you need do it every time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.