When the Company is forced to abandon their attempt to cross the Misty Mountains via the Redhorn Gate (the pass of Caradhras), Gandalf proposes they go "neither over the mountains, nor round them, but under them," via Moria. During the debate Aragorn remarks:
"I too once passed the Dirmrill Gate but though I also came out again, the memory is very evil. I do not wish to enter Moria a second time."
I haven't read much beyond the LOTR trilogy other than The Silmarillion. Does Tolkien ever describe Aragorn's first visit to Moria anywhere?