People who tell you never to use the passive voice are wrong.
There are uses to the passive voice and several problems. Starting with the advantages, the first and most important one is that it helps the writer control the subject.
A) Bob had been murdered.
B) Someone had murdered Bob.
The first has Bob as the subject. Bob’s widow or his mother probably aren’t thinking about the murderer. Likewise, if A or B is a narrative sentence and the murderer is unknown, putting the murderer as the subject of the sentence is both unnecessary and redundant. The verb murder implies a murderer, and the word someone contains the least information possible. So by saying ‘Someone had murdered Bob’ the author has accomplished redundancy and uselessness together in one sentence. There was no redeeming value in brevity either.
That’s the second point of use in the passive voice. Sometimes it allows for greater brevity.
C) Alice was adopted.
D) Alice’s parents had adopted her.
You don’t need the parents because if someone gets adopted, it’s implicit that they were adopted by their parents. That’s how adoption works.
Furthermore, if the narrative is about Alice and the consequences she faces as being adopted, C makes her the subject as in A above. D meanwhile moves the focus to the parents. If the narrative is about the parents, good. Use D. If the narrative is about Alice and her adoption isn’t the focus, but rather the effects that adoption had on her, use C.
The passive voice also allows for focus on the attribute the action having been done and not the action itself. Suppose you’ve got a supernatural mystery, and murdered victims can’t move on until they find out who did it. Murdered Bob is going to be affected by the murder for the rest of the book, or at least his arc. The murder itself may be over and done quickly. If Alice is a young child, the aspect of being adopted is huge to her worldview. She’s different from her siblings. Her parents might love her different. She might not really be in the family. These matters are huge, and if those matters are the crux of Alice’s narrative, they matter. If Alice was adopted before she can remember and has never met her biological parents, the adoption itself might rarely enter her mind. Her status as one who is adopted, not a real kid but an adopted one (I’ve heard this used like this), may affect her worldview and identity in fundamental ways.
In character, it is sometimes used to escape responsibility.
E) I hurt Jane’s feelings.
But in passive voice, the I can be removed.
F) Jane’s feelings were hurt.
If the speaker doesn’t want to take responsibility for hurting Jane’s feelings, the passive voice is a good way to say that because it takes the speaker out of the sentence.
#
The disadvantages of the passive voice are a lack of intensity and that it’s usually more wordy to convey the same information.
G) The tree had been knocked down by lightning.
H) Lightning knocked the tree down.
G is a boring sentence. It lacks immediacy and tension. H is an action. If the lightning storm is going on in the narrative, the author probably wants the reader to care about said lightning storm, and therefore the more interesting sentence is H.
Likewise for the same information conveyed, the passive voice usually requires more words.
I) Jane shot Beth with the gun.
J) Beth had been shot by Jane with the gun.
I is clearly shorter and conveys exactly the same information. If the action is meant to be important, I has more impact. If the action is not meant to be important, I gets the information out there faster so the narrative can move on to something that is important.
Most of a narrative isn’t shocking detail or character description/exposition but rather plot. Events are occurring or characters are talking and thinking. In those cases the narrative is usually served by making the flow quick and snappy, getting to the exciting bits and making getting there as interesting as possible. Thus most of the time the active voice is a better choice. But a lot of people say never use the passive voice, and this is wrong. If there was never an excuse to use the passive voice, it wouldn’t exist.
There’s another set of uses in instructions and general nonfiction that flows from the subject discretion of the first point.
Step 1: Turn the knob to the left.
Step 2: The knob should be fully turned to the left.
By keeping the sentence structure and the subjects/objects unchanged a reader doing a complex task may find reading the instructions easier. This comes up a lot in product manuals, but it’s not really connected to writing fiction.