It is possible to hard or soft-boil an egg inside the shell using a microwave. It takes seconds as opposed to minutes on the stove top.
The danger in doing this with a microwave versus a stove is that when you remove the egg from the microwave, it continues cooking even though it is away from the appliance. The shell holds the heat inside the egg and the steam from the heated fluids continues to cook it.
This steam pressure can cause pressure buildup and even result in a delayed reaction that makes the egg explode from the shell. Flying fragments from the explosion can get in eyes or burn skin.
Fried Versus Microwave
You can produce delicious scrambled eggs in the microwave without fear of any unusual danger. Microwaved foods can be hotter than conventionally cooked counterparts, but it is not dangerous to use the microwave for certain cooking purposes.
The danger is that even when you crack the eggshell and spill the egg onto a plate for that “over-easy” or “sunny-side up” egg, a thin film of the yolk sac remains holding the bright yellow yolk in place. That thin film is strong enough to contain the heat and steam and explode if cooked too long in the appliance, or worse, explode on you when you remove the egg.
Always remove eggs from their shells before cooking in the microwave. Always scramble the eggs, or at least, break the yolk to puncture the yolk sac and prevent it from exploding inside the microwave or after it is removed from the appliance.
Keep eggs and other foods separate while cooking so they do not contaminate each other during the raw or semi-cooked stages At least, if you absolutely must have a hard or soft-boiled egg in the shell from a microwave, puncture the shell with a needle, making sure to get all the way in to puncture the egg and yolk sac so they don’t explode inside the shell.