It's actually quite simple; you just use a circular cookie cutter like this one:
You can find these at any cookware store. It's easier to work with the ones that don't have handles, for what I hope are obvious reasons. If you buy a whole set then you can almost certainly find one that's exactly the right size for your bagel.
Just put the cookie cutter into your fry pan and crack the egg into them for a fried egg, or beat them separately and pour them in for scrambled. Generally you won't actually want to scramble them because you're aiming for something that holds together, so just let it set on one side and then flip it, or make it like a granny omelette (lift up the set edges and tilt the pan to get the un-set egg over to the edge of the ring).
The whole microwaving thing you see at coffee shops is just because they have a hundred of them in storage and don't have time to actually cook them to order. They're just heating an already-cooked egg, not actually cooking it in the microwave. You shouldn't need to use the microwave at home.