Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New sample script: Add site collection admin to all sites in the tenant #2220

Closed
plamber opened this issue Feb 27, 2021 · 8 comments
Closed

Comments

@plamber
Copy link
Contributor

plamber commented Feb 27, 2021

Docs
Author Salaudeen Rajack
Original Post link
Description Add site collection admin to all sites in the tenant
Keywords SharePoint Online, Governance
@veronicageek
Copy link
Contributor

I don't see spo user add in the documentation for this one? 🧐

@waldekmastykarz
Copy link
Member

Would using spo site set --owners [owners] be an option https://pnp.github.io/cli-microsoft365/cmd/spo/site/site-set/#options? Not sure if there is anything non-site in it, but if so, then we might need to fall back to spo site classic set --owners [owners] to update just the site: https://pnp.github.io/cli-microsoft365/cmd/spo/site/site-classic-set/#options. If neither of these are suitable, then we have a gap that we should address.

@veronicageek
Copy link
Contributor

Thanks, I'll have a look.
Happy to take this one if you want to assign it to me.

@waldekmastykarz
Copy link
Member

Awesome! Appreciate your help! 👏

@veronicageek
Copy link
Contributor

Hi @waldekmastykarz,
After some testing, I'm a little bit torn with this one, because I think it's dangerous.

In the script, the logic would want to list all the sites, then add the user. But there are many sites that will be accounted for with the script, but not visible in the SPO admin center (i.e.: the Search site collection). So while we can possibly remove the Search Site Collection from the list by using $allSPOSites | Where-Object {$_.Template -ne "SRCHCEN#0"}, it'll be difficult for others.

I'm thinking about the App Catalog site collection (if created), but more importantly the sites created with Private Channels! 😬
Running the script as-is will add the user as SCA in those private sites, with no way to check OOTB.

I think it'll be safer to create a script where we import a .csv file with the desired sites.
Let me know what you think

@waldekmastykarz
Copy link
Member

You're right @veronicageek. Especially when it comes to admin tasks, it's better to err on the safe side. Having a list of sites to include is the way to go.
What do you think about including some instructions about how to build the list of sites, like find sites of specific type or include sites matching a URL pattern?

@veronicageek
Copy link
Contributor

@waldekmastykarz - I'll see how I can turn this out & feedback 🙂

@veronicageek
Copy link
Contributor

Hi @waldekmastykarz,
If you're OK with the PR, you may want to change the title of this issue because it's a little different now 🙂
Have a good weekend!

@waldekmastykarz waldekmastykarz added this to the v3.9 milestone Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants