Blair, Scotland's former captain and most-capped scrum-half, will join the coaching team ahead of the summer tour.
He will be joined by assistant coaches Matt Taylor and Dan McFarland, who also work with Townsend at Warriors.
"I'm delighted to take on this role with Scotland at an exciting time in the team's development," Blair said.
"Being a young coach, I feel very lucky to work with coaches of the calibre of Gregor [Townsend] and Dave [Rennie, the incoming Glasgow Warriors head coach] and hope I can contribute to further successes for both Scotland and Glasgow on the pitch."
Townsend takes charge of the Warriors for the final time at Scotstoun against Edinburgh in the last Pro12 game of the season and the second leg of the 1872 Cup.
He will then immediately succeed Vern Cotter as Scotland head coach, before naming his squad for the summer tour to Italy, Australia, and Fiji.
Blair, who earned 85 caps for his country and toured with the British and Irish Lions in 2009, will join the touring party while retaining his duties and responsibilities to the Warriors outwith the test-match windows.
"Mike [Blair] has thrived as a coach since his retirement from playing at the end of last season," said Townsend.
"He's proven to be an excellent addition to the Warriors' backroom staff and I'm delighted to bring that expertise into the Scotland set-up.
"He will perform a similar role with the national team, which will be focused on three areas: assisting with our attack, improving our skills and also working closely with our group of scrum-halves."
Glasgow Warriors skills coach Mike Blair will return to the Scotland set-up as part of incoming head coach Gregor Townsend's backroom staff.