Largely unknown outside Italy, Allegri cultivated an attractive brand of attacking football when leading unfashionable Sassuolo to promotion to Serie B in 2008.
He was then plucked from obscurity by top-flight side Cagliari where he continued his good work for two seasons.
"Today is the first day. Now I will have time to think and a month available to prepare for the new season," Allegri told Milan's television channel after signing a two-year deal.
"Coaching Milan represents a very important point of arrival in my career. I'm part of one of the strongest clubs in the world."
The 42-year-old replaces Leonardo, who took over from Chelsea-bound Carlo Ancelotti in mid-2009 but left by mutual consent last month. The Brazilian guided Milan to third in Serie A despite clashes with owner Silvio Berlusconi over tactics.
The appointment of rookie Leonardo was seen by Milan fans as a cheap option as he was already on the payroll as technical director.
The arrival of Allegri rather than a big-name coach may be viewed by the same supporters as further proof Berlusconi has tightened spending during the economic crisis but also wants to strengthen his grip on team affairs.
Assistant coach Mauro Tassotti and youth team boss Filippo Galli were also in the running for the role, with Milan deciding low-profile names with clear coaching credentials fitted their new model better.
Allegri proved his ability by winning Italy's "Golden Bench" award in February after his peers voted him Serie A boss of the year for his attacking play and good use of modest players and funds.
Cagliari sprang a big surprise in April by sacking him, in the midst of their second steady season in mid-table. Media reports said the side were annoyed with their promising young coach for courting other clubs while form suffered.
Allegri's move to Milan took several weeks to be finalised because he was still contracted to Cagliari despite being sacked. Club president Massimo Cellino was reluctant to let him go given his anger at the coach's last few months in charge.
"The negotiations extended for a month but luckily everything ended well," Allegri added.
"I replace Leonardo, a coach who has done a good job. Under his leadership Milan fought until the end for the scudetto and the team played very well. Therefore I receive a very important legacy."
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.