To make a planet sized organism generate a continuous magnetic current strong enough to repel the solar wind, embedded permanent magnets would be entirely unsuitable - It would take a large planetoid's worth of magnesium or neodymium to generate a field strong enough, and be difficult to alter that field in response to stimuli or threat. In addition, that would likely be a small, strong magnetic field that only extends a few miles above ground and pulls the iron out of blood - a large, diffuse one is better suited to protection from solar wind.
The way we humans, the electric eel, or other earth-evolved biological life generate electricity would be much more responsive - and presumably a planet sized entity could have an enormous nervous system generating a potentially significant electromagnetic field (if it's brain is anything like ours). That said, thinking demands an enormous amount of energy (your brain makes up ~2% of your body mass, but accounts for ~20-25% of your caloric expenditure) and generating electric current just for the sake of it is even more energy intensive. In short, it's a massively inefficient process that would take a crazy amount of energy to maintain, not well suited for a planet's magnetic field.
What I'd propose is something combining the best of both worlds - a massive 'circulatory system' that contains a highly compressed, nonreactive liquid filled with iron particulate - basically a thick sludge of fine iron filings and mineral oil. This circulatory system would be composed of 10-50km wide tubes, deep under the planet's surface, powered by an absolutely enormous biological pump. In the same way that an inorganic planet's magnetic field was generated by the movement of a massive iron core, this living planet would generate a magnetic field similar to a spinning iron core - the right size/strength to repel solar wind, unlike permanent magnets, and less energy intensive (by virtue of the circulating fluid's huge inertia and a well designed circulatory system) and continuous, unlike a biological field.
In addition, since it was powered by an enormous circulatory system, the planet could alter or reroute the flow of liquid through ring/coil shaped capillaries in it's 'skin' nearer the surface, inducing local magnetic fields to, say, crash an escaping spacecraft or scramble non-hardened electronics.
Hell, it could even decide to pause pumping this magnetic fluid altogether for a period of time to sterilize life on it's surface, or majorly alter the path of circulation to change it's spin/move it's axis of rotation (resulting in anything from objects on the surface flying off into vacuum if it abruptly slowed surface spin to instant seasonal change winter->summer if it altered it's axis).
That solves your magnetic field issue, gives you a ton of optional devices for your planet to take an active role in the progression your story, and you'd get the cool factor of being able to legitimately talk about the planet's 'heart'.