I've questioned that logic too here. It's always "no matter what,they are Muslims and we are Muslims".
Well...I do not think the AZ case is all about Muslims. It is more about following Turkey's foreign policy rather than understanding the nuances associated with it...Technically rather than aligning with Iran which is their next-door neighbor and Muslim nation they align with Turkey/USA/AZ. In the same way, even India is also making a mistake in overtly getting engaged with Armenia which is not at all needed as AZ is our better trading partner than Armenia.