In 2005 Farmer was appointed Australia's ambassador to Indonesia, replacing David Ritchie. Media saw Farmer's appointment as "something of a reward... after service to the Howard government through many immigration controversies". However, in the post his initial appointment was extended under the Labor government by two years. While in Jakarta, Farmer assisted in negotiations to return a group of 78 Sri Lankan asylum seekers to Indonesia after they were apprehended by the Australian Customs vessel "Oceanic Viking". He also helped to send Australian-funded relief aid to victims of the 2009 Sumatra earthquakes.