Using the grand canonical ensemble, we can show that the occupation factor of an energy level (when the temperature $T$ and chemical potential $\mu$ are fixed) is given by $$ f_E(T,\mu) = \frac{1}{\exp \frac{E-\mu}{kT} \pm 1} \quad (1)$$. The total number of particles and energy in the system are thus given by $$ N(T,\mu) = \int dE \, DoS (E) f_E(T,\mu) \quad (2)$$ $$ U(T,\mu) = \int dE \, E\, DoS (E) f_E(T,\mu) \quad (3)$$
On the other hand, the chemical potential is related to the internal, free or Gibbs energy of the system as $$\mu = \left( \frac{\partial U}{\partial N} \right)_{S,V}= \left( \frac{\partial F}{\partial N} \right)_{T,V}= \left( \frac{\partial G}{\partial N} \right)_{T,p} \quad (4)$$
Is there a way to recover these relations from (1) - ie to check that the $\mu$ which appears in eq.(1) is indeed a chemical potential is the sense of (4) ?