At your preferred consulate! It doesn’t matter where you are going to pick up your visa. Some have been mistakenly told they cannot get their visa if they are not in their hometown. That is not true. Many tourists get their visa on their way to Iran perhaps while visiting a neighbor country like Turkey, Dubai or Pakistan