I agree people lean too heavily on Free Speech when criticizing the government, but there's actually a long running debate going back decades regarding the extent to which OFAC specifically and the U.S. government's sanctions regime generally can restrict various communication and publication platforms and activities. Just a few months ago I think there was a story on HN about the IEEE tweaking their participation rules, and IIRC their lawyers were pushing back on the OFAC.
Here's a 2012 law review article (which I haven't read, yet), "Information Wants to be Free (of Sanctions): Why the President Cannot Prohibit Foreign Access to Social Media Under U.S. Export Regulations", https://scholarship.law.wm.edu/cgi/viewcontent.cgi?article=3...
Arguably, Microsoft and Github are simply choosing to participate more strictly than what is legally required--including what's constitutionally permissible for OFAC to enforce. And of course that's the problem with these large, centralized, free services. They can kick people off whenever they want whether it was legally required by law or not, and they will because they're going to be very risk averse in situations where they're not directly deriving revenue. There are many other areas where corporations, in the pursuit of profits, play fast & loose with the law in the face of far greater potential fines and liability.