We describe x-ray resonant magnetic diffraction measurements at the Fe K-edge of both the parent BaFe2As2 and superconducting Ba(Fe0.953Co0.047)2As2 compounds. From these high-resolution measurements we conclude that the magnetic structure is commens
urate for both compositions. The energy spectrum of the resonant scattering is in reasonable agreement with theoretical calculations using the full-potential linear augmented plane wave method with a local density functional.