Josip Ilicic gave Champions League-chasing Atalanta a first-half lead but Mario Mandzukic, on as a substitute for Barzagli, equalised for a 1-1 draw with the help of an error by goalkeeper Pierluigi Gollini.
The point gained by Atalanta leaves them third in the table, ahead of Inter Milan on goal difference and AC Milan by a point going into the season's final game.
Cristiano Ronaldo fired an early Juve chance over, while at the other end, Wojciech Szczesny denied Remo Freuler and the visitors had a penalty appeal turned down after a VAR review of a free-kick which struck the Juventus wall.
The home crowd were in carnival mood as they cheered departing coach Allegri – who has won the title in all four of his seasons with the club – and defender Barzagli at various points of the first half.
Ronaldo attempted to inspire Juve on the field, first with a backheeled through-ball after a spell of ball-juggling and then when he headed just wide – though the latter attempt would not have counted due to an offside flag.
Ilicic gave Atalanta the lead with a close-range finish after Alejandro Gomez's 33rd-minute corner was flicked on across the six-yard box by Andrea Masiello.
Juve's response, through efforts from Miralem Pjanic and Paulo Dybala, was wayward and they still trailed at the interval.
Ronaldo was booked as the players left the field at half-time for protesting to the referee, and his frustration continued as he again lashed over early in the second half.
Joao Cancelo's interception denied Ilicic the chance of a second but Juve pressed forward once more and Dybala sent a free-kick into the wall, while Hans Hateboer went dangerously close to an own goal.
Barzagli left the field in tears when he was replaced by Mario Mandzukic at the hour mark of his 262nd and last appearance for the Bianconeri.
He was embraced by all of his team-mates and coach Allegri, while the crowd again responded with a standing ovation for a man who has contributed to all eight of the club's successive scudettos.
Szczesny turned Ilicic's free-kick away for a corner and Marten De Roon sent a volley off target, while Federico Bernardeschi went close with an audacious backheeled effort at the other end.
With 10 minutes left, though, Mandzukic levelled the scores for Juventus, sliding in beyond the back post to meet Juan Cuadrado's deep cross with a low finish that found its way under Gollini.
Bernardeschi was shown a straight red card in stoppage time for a foul on Musa Barrow but the remaining couple of minutes passed without further incident as the game finished all square.