I think Pakistanis of all people would understand the sensitivity of border changes. The Kashmir situation is similar to what is going on here with different context.
Iran has indicated Karabakh is rightfully Azerbaijani land. BUT, Armenia proper is of course a different situation, so border changes are not acceptable to Iran.
Iran is not choosing to be any enemy of Turks. It's not about that. If someone chooses to become an enemy of yours, then their is no choice and Azerbaijan has made many claims of land where their are majority of Azeri-speaking people. People who have been part of Iran practically since the 16th century, as a matter of fact, one can even say the Azeri people of Iran are the ones who built most of what Iran's territory looks today. The entirety of my mother side is Azeri speaking. People in Iran are not racist people, and have no care of what ethnicity you are from.
It is also well discussed in Iran, that an Iranian nuclear scientists assassination (Fakhrizadeh) was carried out using Azerbaijanis territory as a surrogate. As well as other activities like quadcopter penetrations. Iran has shown restraint because it does not want to create difficulties with its majority Shia muslim neighbor. Although I should mention, most Azerbijani people are atheistic from 2 centuries of Russian occupation.
Their are important geopolitical agreements where as well, we Iran requires Armenia and Georgia to have access to the Black sea and their is concern of this access being cut off by Azerbaijan if it decides to do so. Their is no proper agreement with Iran on this matter.
But mostly I wonder how muslims on this website can justify Azerbaijanis purchases of Israeli military equipment.