WASHINGTON — The fight over President Trump’s systematic stonewalling of Congress escalated on two fronts on Monday, as a federal judge upheld a subpoena for his financial records even as the White House instructed its former top lawyer to defy a subpoena to testify before lawmakers.

In the first court test of Mr. Trump’s vow to resist “all” subpoenas by House Democrats, a judge ruled that his accounting firm, Mazars USA, must turn over his financial records to Congress — rejecting his lawyers’ argument that lawmakers had no legitimate power to demand the files.

Mr. Trump separately moved to block Congress from receiving testimony by the former White House counsel Donald F. McGahn II at a hearing scheduled for Tuesday, denying House Democrats one of the most important eyewitnesses to Mr. Trump’s attempts to obstruct the Russia investigation. Mr. McGahn will not appear, his lawyer said later.

The fights raise separate but overlapping issues: how far Congress’s power to subpoena information extends, what Mr. Trump can apply executive privilege to in order to keep secret, and whether a president’s senior aides are “absolutely immune” from subpoenas, meaning they do not even have to show up when ordered to appear before lawmakers.