Replace an owner in a Microsoft 365 Group or Microsoft Team
The CLI for Microsoft 365 is a cross-platform command-line interface used to manage or automate Microsoft 365 resources. It is a PnP and community-driven initiative that is growing rapidly over time.
Find all the Teams that a user is an Owner of and replace them with someone else useful for when an employee leaves and ownership needs to be updated. The script is inspired from this blogpost. The script uses the CLI for Microsoft 365 to perform all activities.