The alarm in the clock app goes off after a few minutes. I don't know how long it plays before it stops. I have mine set to a song in my phones music library. I also have "Snooze" toggled on. But there is no way to set how long it plays.
It goes about 5-10 minutes then it'll stop on its own. It's pretty annoying so entires but most time I'm able to stop it. If this really bothers you, the best thing to do is what SwitchBeach is suggesting & find a 3rd party app.
This is a common problem with alarms - alarm clocks, smart phones, microwave "done" beeps, and even my car does this if I turn the key enough to key power and do not fasten my seatbelt. "hello, the engine isn't running! I'm just listening to the radio!" .