Holders Chelsea will play Juventus in Group H and both clubs will be expected to advance from a section also including Russian champions Zenit Saint Petersburg and Malmo.
The Swedish champions knocked out Steven Gerrard’s Rangers in the third qualifying round.
Saint Petersburg will host this season’s Champions League final on May 28 next year.
Thursday’s draw in Istanbul also saw Barcelona come out in a fascinating Group E along with Bayern, Benfica and Ukrainian champions Dynamo Kiev.
For Barca it will be a first meeting with Bayern since they were humbled 8-2 by the German giants in Benfica’s Estadio da Luz in Lisbon in the quarter-finals a year ago.
Ronald Koeman’s side are embarking on a first Champions League campaign since the departure of Messi, with whom they last lifted the trophy in 2015.
“Barcelona is a different team without Messi, but they still have good players in their ranks. We want to get through the group, ideally as winners,” said Bayern sporting director Hasan Salihamidzic.