Missiles were thrown at officers as they tried to break up an illegal rave in Huddersfield on Saturday night.
West Yorkshire Police say around 300 people had gathered in Deighton.
Officers, who encountered some hostility upon arrival, managed to turn the music off and disperse the crowd, according to police.
In a statement the force added: No officers were injured and they were met with applause from residents in the area.
When officers arrived there were around 300 persons present many of whom were hostile and missiles were thrown at officers. The music was quickly turned off with the equipment seized and the attendees were dispersed from the area. No officers were injured and they were met with applause from residents in the area.
It comes as the government announced fines of up to £10,000 for those organising illegal raves in England will come into force ahead of the bank holiday.