You'll see this error if the size of the Bash history in your submitted image is more than 1 kilobyte (KB). The size is restricted to 1 KB to restrict the file from containing potentially sensitive information.
To delete the Bash history:
Deploy the VM and select the Run Command option on the Azure portal.
Select first option RunShellScript and then run the command: cat /dev/null > ~/.bash_history && history -c.
After the command runs successfully, restart the VM.
Generalize the VM, take the image VHD, and stop the VM.
Resubmit the generalized image.