The International Cycling Union (UCI) says the 30-year-old former Bardiani CSF rider is suspended until May 3, 2021.
The UCI says he tested positive for growth hormone-releasing peptides in training one week before the Giro began in May. Pirazzi can appeal against his ban at the Court of Arbitration for Sport.
Pirazzi along with Nicola Ruffoni was kicked out of the eve of the 2017 Giro d'Italia after testing positive in an out-of-competition doping test prior to the event.
Both were fired by Bardiani CSF and the team itself was suspended for a month after the race concluded in line with UCI rules for teams with multiple positive results.
The UCI has not yet commented on the fate of Ruffoni, who denied using banned substances.