What’s the difference between “approved” and “legal” procedure?
The AIM is not regulatory, just best practices approved by the FAA. You should do what the AIM says, but as PIC you are free to ignore it.

The FARs are regulatory, so as long as you don't violate them, what you're doing is legal. You must do what the FARs say (unless you have an emergency, of course).

In the case of pattern entry, other pilots are expecting you to do what the AIM says (45 to downwind), so doing something different is probably unsafe--especially if you aren't in radio contact. But if there is nobody else in the pattern, that reason doesn't apply and it is safe to enter however you wish (straight in, crosswind, etc.). It is up to you as PIC to make this decision.

The same logic is true generally: if you understand why the AIM says to do (or not do) something, you probably understand when it's okay to ignore it.