The first evil opportunity
The attempt of the powers of evil to storm heaven in order to FORCE God off his throne failed miserably (Luke 10:18). After this failure, the devil was no doubt looking for ways to get revenge. An opportunity soon presented itself, in the unlikely place of a garden, for him (he believed) to assert his demonic power over something made by the Being who created him.
The devil, however, never seriously considered the following. Why was he allowed easy access to the Garden of Eden, an absolutely beautiful place on the earth where the Lord placed the first two humans he created? In addition, why was he allowed to possess any animal he selected and carry out his evil plan to deceive Adam and Eve into sinning and bringing God's judgment upon them? After all, the Eternal certainly had the power to protect the first humans from him (as he initially did for Job - see Job 1:10).
It never occurred to Satan that his disobedient actions in Eden would be used to ultimately bring the greatest GOOD to the humans he desperately wanted to destroy! His mind had become so twisted due to his rejection of righteousness and was so blinded by an obsession to do wrong that he could not resist doing evil.
It was God's will to allow Satan to tempt Adam and Eve. He knew that it was almost certain that our first parents would succumb to his temptations and sin (after all, his lies were so convincing that one third of the angels believed them and turned themselves into demons long BEFORE Adam was created!). The tempter's actions made possible not only His plan to teach all humans that Satan's way of life did NOT work, but also allowed the Godhead to perfectly demonstrate their love through the life, death and resurrection of Christ.
We now come to the interesting example of Job, one of the most righteous people in the Bible (Ezekiel 14:14, 20). One day the devil, after restlessly looking for something to do, traveled to God's throne. The Lord struck up a conversation with his adversary (which he knew would generate an accusing response) regarding the uniquely righteous character of Job (Job 1:6 - 8). Satan responded that the only reason Job was obedient was that it brought him blessings and protection (Job 1:9 - 10).
Lucifer was ultimately allowed to not only destroy all that Job owned but also kill all his children and afflict his body will painful sores (Job 1:12 - 19, 2:6 - 7).
Was God allowing Job to be tested as a means of showing the devil that he was wrong? No! The Eternal knew that his adversary could not resist harming Job if he was allowed to do so. His will (remember, it was HE who brought up the subject of Job) was to use Satan to teach Job, and all mankind, valuable lessons concerning his perfect love and righteousness, and his right as Creator to determine right and wrong for his creation (see chapters 38 to 42). The Lord masterfully used Lucifer's inability to refuse doing wrong as a means of teaching us what was right!
Other Biblical examples
The Bible contains other examples of wicked spirits whose inability to resist doing evil was used to carry out the will of the Almighty.
Abimelech (a Judge of Israel) and the men of Shechem committed the mass slaughter of seventy of Gideon's sons. This was done so that Abimelech could reign as a king in the northern part of Israel. Scripture states that God used an evil spirit to stir up contention between the two parties so that they would ultimately die as punishment for their grievous sin (see Judges 9).
King Ahab was the wickedest person ever to rule Northern Israel. The King's behavior finally earned him a visit by the prophet Elijah who foretold his death for his sins (1Kings 21:19). God, soon after, allowed an evil spirit to LIE through the mouth of 400 prophets as a means of causing Ahab's death in battle (1Kings 22:1 - 38).
The Old Testament contains prophecies regarding the life and ministry of Jesus. Many of these foretell the need of his betrayal, suffering and death as a human in order to make salvation possible. Yet, in spite of knowing these facts and that Christ's sacrificial death sealed his fate (Hebrews 2:14), the devil could not resist possessing Judas and INSURING that sacrifice took place (Luke 22:1 - 4, John 13:27)!
Even though the devil knows that the Bible foretells the total demise of his world government and the destruction of his global army (Revelation 19), he still will indulge in evil during the Great Tribulation period. In fact, he will have help from many powerful demons (Revelation 16:12 - 16) in order to pursue his wicked goals that are prophesied to fail.
Satan will not be able to fight his urge to gather an army of disobedient humans, at the end of the Millennium, to attack Jerusalem (Revelation 20:7 - 9), even though the outcome will result in his eternal death.
The devil and his demons cannot resist ANY opportunity to do evil! They simply cannot stop themselves from pursuing anything that is sinful or wrong even when it fulfills God plan and is foretold to work against their goals. In the end, even Satan, the great tempter, cannot reject the temptation to sin anytime or anywhere!