Iran could really gain much for supporting Azerbaycan now, otherwise Iran will lose influence among worldwide Shias, justification of its narrative, and geopolitical leverage.
Hardly anyone would consider Aran's conflict with Armenia as a Shia cause. This is specially true for the more religiously inclined among Shia Muslims, who do not view Baku's jailing of ulema, its tolerance of gay parades, its banning of hijab at universities, its use of masonic symbols in a positive light.
Afterall the regime in Baku is staunchly secularist, meaning that it operates a strict separation between religious considerations and (geo)politics. Which is why it seems not to have any difficulties welcoming insurgent fighters from Syria, most of whom have a reputation of being somewhat sceptical towards Shia Muslims (to say the least).
Shia Pakistanis supportive of the current Arani regime owe their stance to the favorable views Pakistanis generally have towards Turkey. Not to their confessional affiliation.
There is no contradiction between Iran's absolute neutrality in the current Karabakh conflict on the one hand and her general narratives on the others. Supporting actors that promote "ethno"-separatism against her has never been part of Iran's discourse. Likewise, Iran's narrative doesn't focus on exclusive solidarity with Shia Muslims, but chiefly on anti-imperial struggle against the zio-American oppressors, with particular sympathies for oppressed Muslims beyond sect.
Of course if a regime starts expressing hostility towards Iran or working with Iran's existential foes to threaten her territorial integrity and stability, then there is no longer an obligation for Iran to aid them.
Baku chose its side during the 90's Karabakh war: it preferred Tel Aviv over Tehran, as well as backing of anti-Iranian separatism and "ethnic" animosity over strategic cooperation and alliance. There was no obligation for Baku to make this choice, as it was receiving military assistance from Iran until it decided to switch sides. Despite this, Iran never opted for full blown hostility towards Baku, did not cultivate or encourage movements advocating re-annexation of her former province, separated from her by tsarist Russia in the early 19th century, etc.
Iran supported Armenia too after the fall of the USSR!!
Propaganda. Iran supported Aran after the fall of the USSR, until the regime in Baku decided to thank Iran by cultivating "ethno"-irredentist fantasies against Tehran and killing pro-Iranian officers inside the Arani armed forces, prior to entering a military alliance with the zionist entity and allowing Mossad operatives and Isra"el"i drones to be stationed on Iran's borders.
The centre of Azerbayjan is Tebriz, which is under the Iranian control. Iran fears Azerbayjan would want her areas back....
Other way around. Aran has been an integral part of Iran for millenia until tsarist Russia occupied that land in the early 19th century. Even the names (Aran, Azarbaijan) are Iranian.