@ivaylo.valkov
This should be possible but only if you use groups to manage your role and license assignments. Otherwise you will need to use custom Powershell.
In Azure AD, you can have groups assigned to role assignments or licenses. Then during a deprovision use Adaxes to remove the user from the group, and thus removed from the role or license assignment.