In Mr. Schneiderman’s seventh year as attorney general, the office has been transformed into a bulwark of resistance amid an unusually expansive level of confrontation with the federal government. Other Democratic state attorneys general are undertaking similar efforts, often in concert, like Xavier Becerra in California, where extra money was set aside in the budget for the attorney general to battle the Trump administration.

How far Mr. Schneiderman is willing to go in taking on Mr. Trump could define his political career, particularly in a blue state where disapproval of the president is high. The attorney general’s office potential for troublemaking and generating national headlines was redefined in the early 2000s by Eliot Spitzer. Mr. Schneiderman is a less combative man who was often the target of Mr. Trump’s Twitter wrath amid a three-year civil investigation into Trump University. In the end, Mr. Schneiderman’s office extracted a $25 million settlement in the case.