Microsoft president and chief legal officer Brad Smith said on Tuesday that the company is "principled" about the sorts of people it works with.
The statement comes on the same day that Microsoft announced it's one of 34 companies that signed the Cybersecurity Tech Accord, a document promising that, among other things, participants won't help governments operate cyberattacks against innocent people or companies.
"When it comes to people asking for help from our consultants or other services of that kind, we can pick and choose, we can be principled, and we are," Smith said on CNBC's "Closing Bell."
Smith said technology companies are increasingly able to figure out who's behind cyberattacks. The U.S. blamed North Korea for the WannaCry attack, for example, he said, and the NotPetya ransomware attack has been attributed to Russia.
"One never holds people necessarily responsible for their government, but one does have the ability to be very careful in what one does with the government itself," said Smith, who became Microsoft's president in 2015, taking on a title that had not existed at the company since 2002, when Richard Belluzzo left.
Earlier this week Microsoft announced new security tools, including a secure operating system for internet-connected devices.
HPE and Oracle are among the other companies that have signed onto the accord. Microsoft's top competitors in the public cloud market, Alphabet and Amazon, are not currently on board.