The 26-year-old right-back arrived at Pittodrie on loan from Brentford in January and was in the League Cup final-winning side.
He will sign a two-year contract at the beginning of July, with manager Derek McInnes saying: "We're really pleased to get Shay.
"He will no longer be a loan player and will be an Aberdeen player and I think that's really important."
Logan, who joined Brentford in 2011, made 19 appearances for the Dons, scoring once.
And McInnes added: "I thought he showed enough in his loan spell with us last season in terms of his qualities and we're just looking for that consistency of performance going forward.
"We're delighted he sees Aberdeen as the place to play his football and we're looking forward to working with him again."
Aberdeen have agreed a pre-contract deal with Shaleum Logan.