# Sample Code used to Create a Unified Group, for use with the All Staff Team
# Andrew Sharrad 1/12/2020 v1.0

$UserName = "globaladmin@myschool.org.uk"
$Password = "Password99!"

$EnableAuditing = $true

$StaffTeamName = "Staff Team"
# This group name is the default group name in STEPER.INI under [AllTeachersGroup]

# Do not edit the lines below


$GAPassSec = ConvertTo-SecureString -AsPlainText $Password -Force
$GACreds = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $UserName,$GAPassSec


if ($PSVersionTable.PSVersion.Build -le 17134) {
    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
}
Install-PackageProvider -Name NuGet
Install-Module MSOnline -Confirm:$False -Force -SkipPublisherCheck
Install-Module ExchangeOnlineManagement -Confirm:$False -Force -SkipPublisherCheck


Connect-MsolService -Credential $GACreds
Connect-ExchangeOnline -Credential $GACreds -ShowBanner:$false -ShowProgress:$false -Verbose:$false


if ($EnableAuditing -eq $true) {
    Enable-OrganizationCustomization
    Set-AdminAuditLogConfig -UnifiedAuditLogIngestionEnabled $true
}

New-unifiedGroup -DisplayName "$StaffTeamName" -Alias "StaffTeam" -accesstype Private -AutoSubscribeNewMembers:$false -Notes "Microsoft Team for all staff collaboration" 
