The most famous account of Satan, face-to-face with God and accusing one of His elect, is from Job 1:6-11.
A similar scene unfolds in one of the visions of the prophet Zechariah.
1 Then he showed me Joshua the high priest standing before the angel of the LORD, and Satan standing at his right hand to accuse him.The high priest Joshua is not Moses’ successor; he is the priest of Ezra 5:2 who returned with the exiles. As a representative of the Jews, he stands in God’s court accused by Satan.
2 The LORD said to Satan, "The LORD rebuke you, Satan! Indeed, the LORD who has chosen Jerusalem rebuke you! Is this not a brand plucked from the fire?"
3 Now Joshua was clothed with filthy garments and standing before the angel.
4 He spoke and said to those who were standing before him, saying, "Remove the filthy garments from him." Again he said to him, "See, I have taken your iniquity away from you and will clothe you with festal robes."
5 Then I said, "Let them put a clean turban on his head." So they put a clean turban on his head and clothed him with garments, while the angel of the LORD was standing by.
6 And the angel of the LORD admonished Joshua, saying,
7 "Thus says the LORD of hosts, 'If you will walk in My ways and if you will perform My service, then you will also govern My house and also have charge of My courts, and I will grant you free access among these who are standing here. (Zech. 3:1-7, NASB)
Apparently we enter the scene after Satan’s accusations have been made, just in time to hear the Lord’s rebuke. The "brand plucked" is a reference to the nation rescued from Babylon.
The is quite a bit of theology in this short passage. Joshua’s filthy garments represent his own, or maybe the entire nation’s "righteousness" (Isaiah 64:6). As such, he is not presentable to holy God. Joshua’s garments are removed, his sins are forgiven, and he is clothed in the righteousness of Christ (Gal 3:27). Only then is Joshua is acceptable to the Lord.
It is worth noting that in the entire cleansing process, Joshua contributed nothing but his own iniquities. No credit was afforded him because of any righteous deed or act of his free-will. It was all of grace-- all a free gift of God.
This pattern is played out over and over again. We are dead in sin. Satan accuses us before God. Because of Christ’s work, we are cleansed with His righteousness, and by it are made acceptable. And like Joshua, we are still admonished to glorify God by obeying His command, with the promise of great reward.