He will leave the Association in September to progress his legal career by training to become an advocate.
The Scottish FA will look to employ a new compliance officer in the near future.
"The last three years have flown by - the fastest three years of my life," said Lunny on the Scottish FA website.
"It has been a real privilege to have worked at the Scottish FA and it has been a tremendous experience.
"I've thoroughly enjoyed my time here and in Scottish football but I am also looking forward to progressing my legal career.
"The process of becoming an advocate started back in 2005 for me, and I just completed my entrance exams in February.
"I now have nine months of training ahead of me, commencing in October, and I am looking forward to the challenges that lie ahead."
Lunny joined the Scottish FA from the Crown Office and Procurator Fiscal Service in October 2011 as its first-ever compliance officer.
Previously he was employed as a legal officer for the United Nations' International Criminal Tribunal for the former Yugoslavia in The Hague, where he handled war crimes prosecutions.