Have we circled back to discussing casting Animate Object on a corpse, yet? That is my favorite part of this never ending circle.
In the end, this tends to be a houseruled area. As such, talk to your DM. In my setting, creating undead is inherently evil for 2 reasons:
1.) Drawing upon this type of necromantic requires manipulating death and taking energy from the source of all death. That weakens the borders between the Prime Material Plane and the Shadowfell, and between the Shadowfell and the Negative Energy Plane. Both of those increase the chances of random undead being generated.
2.) If the soul/spirit has not passed on entirely (which takes weeks), then the spirit/soul can't move on ... and is slowly consumed by the undead. Even a skeleton or zombie will slowly consume the soul of the recently deceased. Participating in the destruction of a spirit/soul is one of the few undeniably evil acts in my setting.
Even when a long dead skeleton that has seen the soul/spirit pass on centuries ago is animated, the first issue remains - the weakening of the borders ... and that is increased in intensity when the snimated undead has no soul/spirit to consume.
HOWEVER, if someone wanted to play a "good necromancer" in my setting, I'd ask them what they were trying to do and we'd have a discussion. I very rarely say no to a character concept. I can come up with a few different approaches that I'd approve:
1.) Seeker - you believe (for some reason) that it is possible to animate undead without the evil impacts and are studying necromancy to figure it out. You're willing to do a little harm to figure out how to do it.
2.) Life source animation - You've located sacred texts that reveal a different path. Instead of animating the undead by infusing them with negative energy, you create undead by infusing them with positive energy. Your undead are similar to negative energy undead, but different in subtle ways. However, you do not understand the full raifications of your techniques...
3.) Transmutation - Don't play with souls, play with corpses. You use magics similar to animate object to animate physuical undead using transmutation and conjuration magic, not necromancy. The use of corpses is about the showmanship. Yes, defiling a corpse is probably a bit of a no-no in the eyes of many ... but not to you. To you, it is just refuse. You find it useful to use the superstitions of others to their deficit by creating animates that scare them with their spooky design.
4.) You're cursed - You are cursed with a greater curse (no remove curse spell for you - you need a wish) that infuses you with negative energy. If you do not dissipate it through creating undead, undead randomly spawn around you - and you can't control those. If you die, the negative energy goes off like a bomb. Animating dead is an evil, but it is the lesser of two evils ... and if you only animate the truly wicked, you're also enacting vengeance on them, right? Maybe even protecting them from eternal torment in hell?
5.) Alien morality - You're a thri-kreen or some other alien creature that doesn't have the same values or priorities - and doesn't really care if the place you're visiting falls into eternal darkness due to excessive necromancy. Further, you have a bag of corpses from your far off place that you animate ... So you avoid the elves, humans, dwarves, etc... that populate the local lands.
6.) Ignorance - You learn the magic without knowing what the negatives are. You'll have to address it once you learn ... which is role playing gold.
Are these good? No. But I could argue they are mostly non-evil intentions. Not 5 ... that is still evil, but something that could still work in a party with other PCs of heroic natures, potentially.