The 44-year-old McLeod will look after defence in the All Blacks, taking over from Wayne Smith, who will leave the team at the end of the Investec Rugby Championship.
McLeod said he was very honoured and excited to be given the opportunity to work with the All Blacks.
''Having worked in Investec Super Rugby for the last eight years with some of New Zealand's top rugby talent, I was highly motivated to continue that, but at a higher level. To work with the All Blacks in pinnacle events will be both challenging and rewarding.
"I'm very grateful to the Highlanders club for supporting me for the last five years and also encouraging me into this role. On behalf of my family, I'd also like to thanks so many people for their ongoing support."
New Zealand Rugby CEO Steve Tew said McLeod was an outstanding coach.
''We're very pleased to have him join the All Blacks. He's been a key part of the Highlanders coaching team which has enjoyed fantastic success in recent years.
''They were champions in 2015, semi-finalists last year and have already qualified for the playoffs this season. The win over the British & Irish Lions last week was obviously special for him and the team. We look forward to seeing him join the team later in the year."
All Blacks head coach Steve Hansen said: ''We're delighted to be bringing Scott into the All Blacks family. He's done a great job with the Highlanders, he has a passion for coaching defence, and he's demonstrated over a number of seasons that he has the skillset, temperament and qualities that we're looking for and we think he will be a great fit."