Iranian regime claims that the man attacked the embassy after his wife left him for Azerbaijan and he wanted to "bring her back". They've had like 4 different versions of the official story thus far, including one involving the man leaving his daughter in the car before going to the embassy being disproved literally minutes afterwards. Additionally the eyewitnesses claim that the man had a woman with him during the shooting and the shooting was conducted on a street with multiple embassies which is usually incredibly heavily guarded.
So yeah, 99% sure that the Iranian government had a hand in this. This happened literally only a few days after several Iranian operatives were caught in Azerbaijan.