We investigate ideal quantum gases in D-dimensional space and confined in a generic external potential by using the semiclassical approximation. In particular, we derive density of states, density profiles and critical temperatures for Fermions and Bosons trapped in isotropic power-law potentials. From such results, one can easily obtain those of quantum gases in a rigid box and in a harmonic trap. Finally, we show that the Bose-Einstein condensation can set up in a confining power-law potential if and only if D/2 + D/n >1, where D is the space dimension and n is the power-law exponent