Holders Chelsea have been drawn against Serie A giants Juventus, Russian club Zenit St Petersburg and Swedish side Malmo in the Champions League group stage.
Premier League champions Manchester City have been drawn to face Paris St-Germain, RB Leipzig and Club Bruges.
Manchester United face Villarreal, who beat them in last season's Europa League final, as well as Italian club Atalanta and Swiss side Young Boys.
Liverpool are in a tough group with Atletico Madrid, Porto and AC Milan.
Group stage draw in full:
Group A: Manchester City, Paris St-Germain, RB Leipzig, Club Bruges
Group B: Atletico Madrid, Liverpool, Porto, AC Milan
Group C: Sporting Lisbon, Borussia Dortmund, Ajax, Besiktas
Group D: Inter Milan, Real Madrid, Shakhtar Donetsk, Sheriff Tiraspol
Group E: Bayern Munich, Barcelona, Benfica, Dynamo Kyiv
Group F: Villarreal, Manchester United, Atalanta, Young Boys
Group G: Lille, Sevilla, FC Salzburg, Wolfsburg
Group H: Chelsea, Juventus, Zenit St Petersburg, Malmo
This year's Champions League final takes place at the St Petersburg Stadium in Russia on Saturday, 28 May.