Leicester and Tottenham were put into reasonable groups on paper
Pep Guardiola's Manchester City have been drawn into a group alongside his former club Barcelona in a tough UEFA Champions League draw.
City have also been placed alongside Germany's Borussia Monchengladbach and Brendan Rodgers' Celtic.
Arsenal will face French champions Paris Saint-Germain as well as Ludogorets of Bulgaria and Switzerland's FC Basel.
It was an encouraging draw for Leicester City and Tottenham.
The Premier League champions avoided many of Europe's big hitters and are drawn against FC Porto, Belgium's Club Brugge and Denmark's FC Copenhagen.
Spurs, meanwhile, are up against Russia's CSKA Moscow, Bayer Leverkusen of Germany and France's AS Monaco.
Group A: PSG, Arsenal, Basel, Ludogorets Razgrad.
Group B: Benfica, Napoli, Dynamo Kiev, Besiktas.
Group C: Barcelona, Manchester City, Borussia Monchengladbach, Celtic.
Group D: Bayern Munich, Atletico Madrid, PSV Eindhoven, FC Rostov.
Group E: CSKA Moscow, Bayer Leverkusen, Tottenham Hotspur, Monaco.
Group F: Real Madrid, Borussia Dortmund, Sporting Lisbon, Legia Warsaw.
Group G:Leicester City, Porto, Club Brugge, FC Copenhagen.
Group H: Juventus, Sevilla, Lyon, Dinamo Zagreb.