U.S. Department of Housing and Urban Development Secretary Ben Carson's attendance at President Donald Trump's Phoenix political rally created buzz on social media among those questioning whether the Hatch Act was violated.

The short answer: no.

RELATED: Trump didn't pardon Arpaio in Phoenix — but hints that he will

The Hatch Act of 1939 prohibits federal executive-branch employees from engaging in partisan political events — like Tuesday's rally.

The law does not apply to the president, vice president or employees appointed by the president with the advice and consent of the U.S. Senate, according to the U.S. Office of Special Counsel.

Carson, who was appointed by Trump and confirmed by the Senate, was legally able to attend the rally.

READ MORE:

Trump pushes for border wall during Yuma visit

Fake news? Trump supporters circulate photo of Phoenix rally crowds ... but it's not

Ducey wasn't at Trump's rally and here's why