Tehran police chief Hossein Rahimi said the assailant broke the guard post on Friday morning, opening fire on security personnel there.
One security guard died and two others were injured in the shooting attack.
The police have arrested a suspect and are investigating the motive behind the attack.
Rahimi said the assailant tried to storm the embassy with his two young children, and it is thus suspected that there might have been a personal issue.
In the preliminary investigations, the assailant is said to have claimed that his wife had visited the mission in March but she never went back home.
He said he had repeatedly contacted the embassy to find out about the whereabouts of his wife, but he received no response.
“I thought my wife was at the embassy and was not ready to meet me,” he was quoted as saying by the chief of Tehran’s Criminal Court.
Meanwhilr Iran’s Foreign Ministry strongly condemned the attack on the Embassy of Azerbaijan Republic
Nasser Kanaani offered condolences to and expressed sympathy with Azerbaijan’s government and nation as well as the family of the embassy’s staff killed in the incident.