Actually visiting Nagorno-Karabakh Republic is a crime in Azerbaijan, but you won’t get in any kind of problem in Armenia because of visiting Azerbaijan.
I visited Armenia with a friend who had an Azerbaijani visa in his passport and in Armenia they asked a couple of questions regarding his visit from Azerbaijan in front of us, then they let him go (I’m an Armenian from Iran and my friend is Iranian.)
Here’s some first hand experience (I visited the region a few weeks ago). Visiting Armenia is not a problem for Azerbaijan, nor is it the other way around. What is a problem, is having a visa for Nagorno-Karabakh (NKR) in your passport when you want to visit Azerbaijan. Indeed, at best, you will not be let in to Azerbaijan.
It is said that NKR has no problem issuing the NKR visa on a separate piece of paper, so that you can visit Azerbaijan afterwards, but I can not confirm that.
According to this blog, you should try to avoid visit both countries with the same passport. If you get two passports (Israel and USA, for example), try to get into one country by one of them, and to other with other passport (as author of the blog did).
The main problem is possible visiting of Nagorno-Karabakh Republic. It is a crime in Azerbaijan (illegal border crossing), so even if you were in the NKR, don’t say a word about that. They can’t prove anything without your words. Be careful and good luck.
Credit:stackoverflow.com‘