In a Predestined Universe II

Michaelangelo's paintingIn a foreordained universe, where every act is according to God’s plan, why does he become angry when His actors fulfill their roles?

Again the anger of the Lord burned against Israel, and he incited David against them, saying “Go and take a census of Israel and Judah.” (2 Sam 24:1)

We ask why God would be angry with Israel since they were acting according to His will and then, why would he cause David to sin (via the census) and bring further wrath upon the people?