It depends on which virus you are referring to specifically. Viruses come in many shapes and types; their variations are tremendous.
For HIV and Influenza, viruses acquire their envelops after maturation, during the budding off or detachment stage from the host cell.
Hope this helps! :)