VPN here isn't needed at all unless PSN/MS region locks signups or logins which they don't in most regions AFAIK, there may be exceptions like China.Okay. I'm doing this on a PC with no VPN. No games are available in the Xbox app when I change the region to Iran. However, if I change the region to Jamaica you can buy PC games from the Xbox app but it says Game Pass is unavailable.
Where was your original MS account created and do you have a credit card or payment method tied to it from a supported region? Since changing location often doesn't really change your account region, it only changes your current location. It wouldn't stop purchases in non-prohibited countries but would prevent services.
Buying PC games I believe just uses the MS store anyway so purchases would work there regardless, as long as that is in your region. This isn't the same as the Xbox Services/account being available in the country (the actual xbox profile, gamepass, xcloud etc). It's a separate account agreement not tied to the original store purchase. Much like Steam requiring an xbox account registration or Steam requiring a PSN one. The MS store allows the purchase but that doesn't necessarily mean your country officially supports the services required by that software. It's the xbox account agreement thats unofficial in your country and can be terminated by MS as unsupported, of course there is no real reason for companies to do that though. Hope that makes sense.