When should CEOs get involved in public policy

Satya Nadella took over Microsoft nearly three years ago. But he never expected to have to take public positions on controversial issues. So how and when should CEOs get involved in the public discourse?