I wouldn't say 'to my shock'
I was shocked!
I was shocked to hear that/find out that...
Shock is a bigger surprise.
I was surprised he passed the exam because his grades had been below average.
I was shocked he passed the exam because he had always been bottom of the class.