I use it when the action (or the target of that action) is what I
want to emphasize.
For example:
The nation's premier civil rights legislation, the Civil Rights Act of 1964, was signed into law on July 2, 1964.
I could've written: "The US president signed the Civil Rights Act of 1964 into law on July 2, 1964 as the nation's premier civil rights legislation" ... but I wanted the "star" of the sentence to be the Civil Rights Act ...
or
My bike was stolen last week. I had to walk to work until I could get a new one.
I could've written, "Somebody stole my bike last week" ... but I wanted the attention to be on my bike and that it was stolen, not an anonymous thief.
Using the passive voice is a matter of style, not a grammatical error.
That being said, don't overuse it. The passive voice can make your writing wordy with complicated sentence structures. And overuse can make your writing flat and uninteresting



