New-MsOGroup
MSOnline: Create a new Azure AD group
#Requires -Version 5.1
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)]
[string]$GroupName,
[string]$Description,
[guid]$TenantId
)
Process {
try {
$result = New-MsolGroup -DisplayName $GroupName -Description $Description -TenantId $TenantId -ErrorAction Stop | Select-Object *
if ($null -eq $result) { Write-Output "Failed to create group"; return }
$result | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format 'yyyy-MM-dd HH:mm:ss') -PassThru -Force
}
catch { throw }
}Display name of the group
Description of the group
Unique ID of the tenant