If Azerbaijan attacks Armenia, Iran will declare war on Azerbaijan and Turkey will declare war on Iran.
This will be a disaster for the Middle East and the Caucasus similar to disasters of WWI and WWII in Europe.
It is like if history doesnt teach you anything. There were tens of useless Roman-Persian, Byzantine-Persian and Ottoman-Persian wars in the Caucasus that were more costly and damaging than they had any benefit.
Iran is a country of 90mln people and has an army of 610.000 troops and 350.000 reserves and also 2mln Basijis can be mobilized within a month. Add to this Iran's allies in Iraq (90.000 Shia militias), Syria (150.000 troops), Hezbollah (40.000 troops) and Armenia (70.000 troops and 210.000 reserves) and Iran + its allies can field 3,5-4 mln troops.
Turkey has 410.000 troops and 350.000 reserves and Azerbaijan has 300.000 troops, so Turkey can field 1-2mln troops.
On paper Turkey has more tanks and IFVs, but this means nothing as example of Ukraine war has shown. Russia had 15 times more tanks and IFVs than Ukraine and most Russian equipment was destroyed by ATGMs, mines and artillery.
Turkey has 226 F-16s compared to 44 F-14s and 30 Mig-29s of Iran, but F-16 is a light fighter and has small combat radius of only 540kms. Turkey doesn't have anti-radiation capability and Turkey is incapable of suppressing air defences. If Russia with its powerful air force is incapable of suppressing Ukrainian air defenses and establishing air superiority over Ukraine, then Turkey has no any chances of making aircraft sorties inside Iranian territory with their small air force.
Iran is superior to Turkey when it comes to precision-guided munitions. Turkey's 1000km range ballistic missile is in the stage of testing and is not yet deployed or mass produced. Turkey's cruise missile capability is limited to 250km range SOM cruise missile and Turkey doesn't have kamikaze drones. In contrast Iran has already deployed thousands of ballistic missiles, kamikaze drones and cruise missiles. Unlike Turkey, Iran has already employed its precision-guided munitions in war-time situations against Saudi Arabia (Abqaiq attack), USA (Ain-al-Assad attack) and in Ukraine. Saying in other words, Iran has a capability to attack Baku and Ankara, while Turkey is incapable of attacking Tehran.
Entire economy of Azerbaijan will collapse if Iran destroys Azerbaijan's oil infrastructure and electricity generating capacity with Shahed-136 drones/Raad-500 ballistic missiles/Paveh cruise missiles. Azerbaijan can't defend itself against such attacks.
Also, while Turkey's military hasn't fought a major war since WWI, Iran has experience of Iran-Iraq War and many Iranian officers and generals have experience of conflicts in Yemen, Syria, Iraq and Lebanon.
Also there is an issue of Kurdish separatism that can do much more damage to Turkey than to Iran. For example, Iran can easily establish ties with Syrian Kurds, arm and support them.
If Russia enters the conflict, it can cease supply of natural gas to Turkey and Russian gas is 1/4 of Turkey's energy balance. If Russia ceases gas supplies, while Iranian attacks paralyze oil supply from Iraqi Kurdistan and Azerbaijan, Turkey will be left without energy and its economy will collapse with billion of dollars of damage.
Turkish economy is heavily integrated into global economy. If there is a war and mass mobilization, there might be huge capital flight and economic crises in Turkey.
Also democracies like Turkey have much less tolerance for casualties, economic pain and total mobilization than dictatorships or unique, mixed political systems like Iran. It will be very hard for Erdogan to sell total war, economic pain and full mobilization to the Turkish people -probably anti-war demonstrations will paralyze Turkish state.
Anyway, it will be a disaster if there is a TOTAL WAR of massive scale in the region with mobilization of millions of troops because of small piece of rock in southern Armenia.
Three major powers of the Caucasus: Russia, Iran and Turkey should agree to maintain status quo in the region for the purpose of preserving peace and preventing World War I style escalation with catastrophic consequences for everyone.