What Moshe did was permitted because he followed the general conditions of using Hashem's Names, including:
- Using the Name only to avert danger to the Jewish people and/or a Kiddush Hashem (Sefer HaPeliah)
- Be an extremely holy person who is favoured Above, whom even the Malach HaMavet is his friend (See Midrash Petirat Moshe; principle from Sha'ar HaMitzvot Shemot; Sha'ar Ruach HaKodesh 13b, based on Shir Hashirim 1:3)
In theory, it is possible to do this even today, so long as the conditions are fulfilled, but according to HaRav Yaacov Hillel Shlita, in Faith and Folly p.44, the information on how to use the Names is no longer available.
Misuse of the Names is called אִשְׁתַּמֵּשׁ בְּתָגָא
, or "exploiting the crown" (see Sefer HaIkkarim 1:18), and the sin is very great and punishable by death. Yishayahu died because he used one of Hashem's Names to rescue himself from danger (ibid; Yevamot 49b). R' Yehuda HaChasid commanded his students to go back to the situation of danger they had used a Name to escape from (a den of wild beasts) and not use it, and they were devoured (Kanfei Yonah 1:110).
See also Kiddushin 71a.
Which Mitzva is violated by misusing a Name? There are several associations, including the Rambam's Negative Mitzva 65, "שלא לאבד בית המקדש", which includes the halachot of erasing Hashem's Names. R' Moshe Chagiz brings inyanim related to this under his mitzva 513, "שלא לשאול בבעל אוב"*, as I believe using Hashem's Names for personal gain is akin to using sorcery or magic (although much worse). It is also connected, quite obviously, to the Negative Mitzva of Chillul Hashem, and "תָּמִים תִּהְיֶה" (codified as a Mitzva by the Smak), which is a Mitzva about trusting in Hashem and not trying to use special techniques to "cheat" one's way through the difficulties and challenges of life.
* See also chortkov2's citation, which indicates that this is also associated with the Negative commandements of "שלא ללכת בחוקות עכו"ם" and "שלא לנחש כעכו"ם"