Welcome to the forum,
It's all about airspace and minimum safe altitudes. If you stay within your cloud clearances and remain the appropriate distance from the ground, 91.119, then sure, it's legal. Catch is, 91.119(a) indicates that if your power unit fails, you must be able to make an emergency landing "without undue hazard to persons or property on the surface." However, 91.119 does not apply if you are taking off or landing-so it depends how far away you are from the airport.
Obviously safety is a huge factor here-something VFR pilots don't always consider is the IFR flights that could be arriving. They will be with ATC until shortly before they arrive and possibly in the clouds where you can't see them.
Thanks for posting,
a
