Replace the site collection admin with another user using the CLI for Microsoft 365
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.
This simple script shows you how to replace a site collection admin of an existing site collection with another user. The script uses the CLI for Microsoft 365 to perform all activities.