0

I am trying to create office 365 group through PowerShell. I am using New-Unified group function to achieve. Group is creating successfully but unfortunately site is not creating behind the scenes. Is this not the right way to do it?

I have also tried with MSOnline command New-SPOSite to create new modern site. But site is creating but group is not creating behind the scenes. What is wrong with this?

What is the proper way to do it?

1
  • not sure with this, but I am 100% sure if you create a MS team surely it will ceate a Office 365 gruop and a Associated Team site. is this you are looking for.petri.com/teams-powershell-primer Dec 17, 2018 at 6:32

1 Answer 1

2

You can create a Modern team site with associated O365 group using PnP PowerShell.

New-PnPSite -Type TeamSite -Title "Test Group" -Alias "TestGroup" -Description "Test group desc" -IsPublic

Reference - New-PnPSite

If you want create it via MS Graph, PnP PowerShell also supports that. You can provision the Group as below. You need to be Global admin to run this command AFAIK :

Connect-PnPOnline - Url "https://tenant.sharepoint.com" -Scopes @("Group.ReadWrite.All", "User.ReadWrite.All", "Directory.ReadWrite.All")

New-PnPUnifiedGroup -DisplayName "Test Group" -Description "Test my group" -MailNickname "Testgroup" -Owners "user@tenant.onmicrosoft.com" -Members "user@tenant.onmicrosoft.com"

New-PnPUnifiedGroup

11
  • I have tried with New-UnifiedGroup which is not creating modern site for the group. Are you sure this PnP will do the job?
    – Mihir
    Dec 17, 2018 at 12:31
  • yes, both will work Dec 17, 2018 at 12:34
  • I don't know why, i have created 10 office groups with New-UnifiedGroup command. but none of them created modern team site for me
    – Mihir
    Dec 17, 2018 at 12:35
  • @Mihir any luck ? did you try the above commands ? Dec 29, 2018 at 5:54
  • No luck with these commands
    – Mihir
    Dec 31, 2018 at 10:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.