This paper investigates the wave propagation characteristics and energy harvesting potential of magnetically tunable defective phononic crystal (PnC) microbeams incorporating microstructure effects. A theoretical model of a sandwich-structured phononic crystal beam is developed, utilizing modified couple stress theory. Parametric studies are conducted to examine the influence of microstructure, external magnetic fields, and defect lengths on bandgap and defect band formation. Numerical simulations reveal how defect mode shapes impact elastic wave localization, providing insights for efficient energy harvesting. Furthermore, the transmission curves under different magnetic field intensities and defect segment lengths were analyzed using the spectral element method, along with the output voltage generated by the piezoelectric layer attached to the defect region. The results demonstrate that external magnetic fields offer non-contact tunability of bandgap and defect bands frequencies. This study lays the foundation for optimizing energy harvesting devices based on phononic crystal defect structures.