The former Auckland District Court prosecutor was a non-sworn police staff member and also played for the police rugby team.
Crown prosecutor Robin McCoubrey said the offending had tarnished the reputation of police.
"As he sat in the District Court, no doubt prosecuting drug offenders, he was arranging a drug deal and in the court break, he concluded the drug deal. In the Crown's submission, that goes beyond hypocrisy."
Details of Sarah's offending were revealed in court today.
Sarah accessed the police intelligence computer over 80 times and searched for information on people connected to his drug dealer.
On one occasion he warned the drug dealer that one of his friends should not be spoken to because police were watching him. He also sent a warning to another man, advising him to leave Auckland.
Another time Sarah told his drug dealer that he would wait for one of his colleagues to leave their desk so he could check the police computer under their log-on.
"The point is, Mr Sarah, you accessed the computer for whatever information you could find for the benefit of your drug-dealing friends," said Justice Toogood.
Sarah's lawyer Ron Mansfield said his client threw himself into training after witnessing a traumatic "incident".
He had used the methamphetamine to help with his training.
Mr Mansfield also asked the court to keep in mind that the methamphetamine was heavily cut and only five per cent pure - compared with P, which is usually 70 per cent.
His client had undergone counselling and had made efforts to rehabilitate himself. He urged Justice Toogood to consider home detention.
But the judge started his sentencing by rejecting the possibility of a community sentence.
"It does not adequately reflect your disgraceful nature which has brought you here."
He said Sarah's offending had breached the trust of the public and his colleagues.
The judge referred to 22 references from family, friends and former law colleagues that supported Sarah.
He took time off Sarah's sentence for his early guilty plea and the fact that Sarah had done voluntary community work and sought help for his drug problem.
Sarah was one of 22 people arrested after a 12-month police operation - code-named Operation Ark - that targeted the manufacture and supply of class B drugs MDMA, or ecstasy, and class C drugs such as 4-MEC, better known as mephedrone.
Another accused was Darren Ian Hodgetts, 34, an Auckland traffic police officer who had previously worked for the Fire Service, St John Ambulance and Surf Lifesaving New Zealand.
He pleaded guilty in the Auckland District Court in January to accessing a computer system for a dishonest purpose, and was sentenced to four months' community detention.
Outside court, the officer in charge of the investigation - Detective Senior Sergeant Lloyd Schmid - said police would not tolerate criminal behaviour by their own staff.
"Criminal offending by police staff is not only unacceptable, but it is also extremely disappointing for other staff and the organisation as a whole,'' said the detective who is attached to the Organised and Financial Crime Agency of NZ (OFCANZ).
After the hearing, Mr Mansfield said his client was truly sorry for what he had done.
Asked how Sarah would cope in prison, he said everyone would appreciate the strain on his client.
"The Department of Corrections will look after him.''