European champions Liverpool will take on Napoli in a friendly at Murrayfield on 28 July.
"We are delighted to be able to host this world-class match," said Scottish Rugby chief executive Dominic McKay.
"This match is a unique opportunity to see international club football in Scotland this summer, a treat for any sports fans. The Edinburgh International Festival begins a few days after this fixture so this will add to an already exciting time in the capital city."