Microsoft has joined Amazon in signing agreements with the government to collaborate on projects, regulatory changes and national cybersecurity priorities.