2 Samuel 24:1
1 The Lord’s anger again raged against Israel, and he incited David against them, saying, “Go count Israel and Judah.” 2 The king told Joab, the general in command of his army, “Go through all the tribes of Israel from Dan to Beer Sheba and muster the army, so I may know the size of the army.” 3 Joab replied to the king, “May the Lord your God make the army a hundred times larger right before the eyes of my lord the king! But why does my master the king want to do this?”
1 Chronicles 21:1
1 An adversary opposed Israel, inciting David to count how many warriors Israel had. 2 David told Joab and the leaders of the army, “Go, count the number of warriors from Beer Sheba to Dan. Then bring back a report to me so I may know how many we have.” 3 Joab replied, “May the Lord make his army a hundred times larger! My master, O king, do not all of them serve my master? Why does my master want to do this? Why bring judgment on Israel?”
Notes and References
"... Who Really Was Behind the Test? With the development of and heightened interest in the doctrine of Satan, demons, and angels more generally, which we see among Jewish people beginning around 200 BCE, the question of ultimate and intermediate causes of evil things becomes a focal point for intense speculation. In the case of the Aqedah, this resulted in questioning whether God could be the immediate cause of a test, which called on Abraham to violate the law that God gave to Israel. In Jubilees 17:16–18, Abraham, not Isaac, is the focus of the story. The gap that Jubilees fills in is to explain how God could test Abraham to do such a thing. Like the righteous Job, Abraham is tested by Satan (Mastemah), who argues that Abraham loves his son more than God. It is Satan, not God, therefore, who initiates the test. Jubilees may well be following the lead of the author of Chronicles, who reinterprets his source text in 2 Samuel. In 2 Samual 24:1, Yahweh, angry with Israel, commands David to number Israel and then hands downs judgment on the nation when David obeys. Referring to this incident, in 1 Chronicles 21:1 we read, “Then Satan stood up against Israel and provoked David to number Israel.” The author of Chronicles may be explaining the intermediate cause, Satan, for David’s taking the census, rather than the ultimate cause, Yahweh. In the same way, Jubilees, by introducing Satan into the Aqedah, may be attempting to explain the intermediate rather than the immediate cause ..."
Kissling, Paul J. "The Near-Sacrifice of Isaac: Monstrous Morality or Richly Textured Theology?" in Carroll, M. Daniel, and J. Blair Wilgus (eds.) Wrestling with the Violence of God: Soundings in the Old Testament (pp. 15-30) Eisenbrauns, 2015