Best way to remove all the entitlements from Azure AD accounts

Best way is to implement using Workflow. You can use this as a reference.

Workflow to remove ALL leavers’ standing access - IdentityNow (IDN) / IDN Show and Tell - SailPoint Developer Community Forum

Note that, workflow is a licensed module.