Have Military Law Questions? Ask a Military Lawyer.
You "got in trouble" by which authority, military or civilian?
Well, if you're going to captain's mast you'll be given the opportunity to consult with a defense counsel beforehand. You and your counsel can decide whether you want to accept. My advice would be to accept, as this is the lowest level punishment you're likely to receive for such offenses.
If the command wants to, it could charge you both with altering the ID card and with lying to the officer at the gate.