The Nigerians are making a third consecutive appearance in the biennial tournament for home-based footballers, which Morocco will stage between January 12 and February 4.
They finished third in 2014 in South Africa, but failed to reach the knockout phase in Rwanda last year.
Libya are the only former champions in the 16-team field having triumphed in 2014 by overcoming Gabon, Zimbabwe and Ghana after penalty shootouts.
Rwanda were the last qualifiers for Morocco, winning a play-off against Ethiopia last weekend after Egypt withdrew because top clubs were not prepared to release players.
Equatorial Guinea are debutants and qualified without kicking a ball after opponents Gabon withdrew from the regional qualifying competition.
Namibia, Uganda and Zambia were placed in a group with the Ivory Coast, who came third last year behind champions the Democratic Republic of Congo and runners-up Mali.
Uganda will be desperate to at least reach the quarter-finals after three first-round exits in a row, while the best showing from Zambia was third at the maiden tournament in 2009.
Namibia are the other first-time participants after shocking Zimbabwe in a qualifier despite fielding a rusty squad because a power struggle cancelled domestic football.
Morocco, the second choice as hosts after Kenya were ditched for falling behind with preparations, meet 2016 semi-finalists Guinea, Sudan and Mauritania.
The other section comprises 2011 runners-up Angola, Cameroon, Congo Brazzaville and Burkina Faso.
Morocco’s commercial capital Casablanca, and Agadir, Marrakech and Tangier will stage matches in the 32-fixture tournament.
The winning nation will pocket $1.25 million (about one million euros), up from the $750,000 DR Congo received in Kigali.
Draw
Group A (Casablanca)
Morocco, Guinea, Sudan, Mauritania
Group B (Marrakech)
Ivory Coast, Zambia, Uganda, Namibia
Group C (Tangier)
Libya, Nigeria, Rwanda, Equatorial Guinea
Group D (Agadir)
Angola, Cameroon, Congo Brazzaville, Burkina Faso
Note: matches to be played between January 12 and February 4
Download our app and read this and other great stories on the move. Available for Android and iOS.