Brazil have been paired with Iraq, South Africa and Denmark in Group A of men's football at the Summer Olympics as they chase their first gold medal in August.
Brazil's men have won three silver medals, finishing as runners-up in 1984, 1988 and 2012, while taking home the bronze medal in 1996 and 2008, but have yet to win the top honour.
The hosts' first game will be against South Africa on August 4.
Reigning champions Mexico, meanwhile, will have to deal with London 2012 bronze medal winners South Korea, Germany and Fiji in Group C.
Group B consists of Japan, Atlanta 1996 winners Nigeria, Sweden and Colombia.
Finally, Argentina - who won the tournament in 2004 and 2008 - will meet Honduras, Portugal and Algeria in Group D.
The final is scheduled to take place on August 20 in Rio de Janeiro.
Meanwhile, four-time winners USA meet New Zealand, France and Colombia in Group G of the women's tournament.
Hosts Brazil face China PR, Sweden and South Africa in Group E, while Canada, Australia, Zimbabwe and Germany make up Group F.
The women's final will be held on August 19.