Councils join forces to switch to green energy