The summary.
OBJECTS RATHER THAN TEXT IS THE WHOLE POINT
No output parsing, which is where traditional shell scripting is fragile. Learn to examine what an object contains — everything else follows from that.
FILTER EARLY IN THE PIPELINE
Passing fewer objects forward is substantially faster against remote services.
ERRORS DO NOT STOP EXECUTION BY DEFAULT
So a script continues after a failure and produces incorrect results. Set that deliberately.
CHECK THAT A VARIABLE USED IN A FILTER IS NOT EMPTY
An empty filter selects everything, which at administrative scale is a disaster.
ALWAYS IMPLEMENT A PREVIEW MODE, AND ESCALATE: ONE OBJECT, THEN A GROUP, THEN EVERYTHING
And capture current state before changing it — that is what makes reversal possible.
USE APPLICATION IDENTITIES WITH CERTIFICATES FOR AUTOMATION
A user account requires stored credentials, is subject to additional authentication, and breaks when that person leaves.
SCHEDULED TASKS RUN WITH A MINIMAL ENVIRONMENT
Use absolute paths. Scripts working manually and failing when scheduled is nearly always this.
Alert when a task does not run, not only when it fails.