The canonical partition function for an ideal gas is $$ Z(N,V,\beta) = \frac{1}{N!} \left(\frac{V}{\lambda^3}\right)^N $$ where $\lambda = \sqrt{\frac{\beta h^2}{2 \pi m}}$ is the thermal De-Broglie wavelength. It is straightforward to obtain $$ \langle E \rangle = -\frac{\partial \log Z}{\partial \beta} = \frac{3}{2} N k_B T . $$
From $Z$ the grand-canonical partition function is
$$ Q(\mu,V,\beta) = \sum_{N=0}^\infty \frac{1}{N!} \left(\frac{e^{\beta \mu} V}{\lambda^3}\right)^N = e^{\frac{e^{\beta \mu} V}{\lambda^3}} . $$
The average particle number is
$$ \langle N \rangle = \frac{\partial \log Q}{\partial (\beta \mu)} = \frac{e^{\beta \mu} V}{\lambda^3} . $$
To get the average energy we should do, substituting $\langle N \rangle$,
$$ \langle E \rangle = - \frac{\partial \log Q}{\partial \beta} = \frac{3}{2} \langle N \rangle k_B T $$
but this is true only if we magically ignore the $e^{\beta \mu}$ factor when taking the derivative, otherwise there is an extra (nonsensical) term. I've checked a few sources and this is the accepted solution (after all, it must be this one to be consistent with the canonical ensemble result), although they mysteriously gloss over the issue, so I'm missing something. Thanks.