It depends on the jurisdiction. NM-B cable is not ok for exterior wiring, but a receptacle inset in a wall is 100% ok.
If the box is NEMA 3r rated it may be allowed even as a surface mount. If it is not, cut a hole the size of the box and inset it in the wall then it would be legal again. The box needs to be 3r rated.
It may sound silly but a flush mount box can be inset (I have done this with main panels). At first the inspector was going to red tag it, but when he saw the back of the box was inside the siding he was ok. I have done this several times in the last ~2 years. My boss likes the look better than flush mount but they are a pain in the butt to feed for a main.