We have several ways for the formarity of speak. あなたのおなまえはなんですか is correct, and asking so has no problem for learners. However, since I am Japanese, I would say:
おなまえをおしえてください。
おなまえをおしえていただけますか。
(like "may I have your name?" )
I hope this was helpful.