Electrical code - Cable coming through wall terminating at outlet immediately on the other side
It's not prohibited, just not the wisest thing in the world

While entering a NM cable into a box mounted on the outside of a wall via the back of the box is permitted by Code, it's not a particularly wise move since the paper filler in NM can wick water that gets into the box up the cable, causing a difficult-to-troubleshoot issue down the road.  Using a length of UF of the same gauge from the last indoor box on the circuit into the outdoor box avoids this problem in a relatively inexpensive way.