[en] We investigate the nucleation of superconductivity in an Al film deposited on top of an array of micromagnets with perpendicular anisotropy by dc transport measurements. The absolute control of the magnetic state of the ferromagnets enabled us to explore the superconductor-normal-metal phase boundary as a function of the magnetization M of the dots. For a given external homogeneous field H, the magnetization of the dots can be tuned in such a way to optimize the field and current compensation in the sample, thus yielding a clear enhancement of the upper critical field H-c2. In addition, we theoretically demonstrate that the critical current I-c for a given temperature could be further enhanced by properly adjusting the size of the magnetic dots. These results are fully corroborated by the Ginzburg-Landau theory as well as analytic estimates.