Get-MsOGroupProperties
MSOnline: Get group properties from Azure AD
#Requires -Version 5.1
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true, ParameterSetName = 'Id')]
[guid]$GroupObjectId,
[Parameter(Mandatory = $true, ParameterSetName = 'Name')]
[string]$GroupName,
[Parameter(ParameterSetName = 'Name')]
[Parameter(ParameterSetName = 'Id')]
[guid]$TenantId
)
Process {
try {
if ($PSCmdlet.ParameterSetName -eq 'Id') { $result = Get-MsolGroup -ObjectId $GroupObjectId -TenantId $TenantId -ErrorAction Stop | Select-Object * }
else { $result = Get-MsolGroup -SearchString $GroupName -TenantId $TenantId -ErrorAction Stop | Select-Object * }
if ($null -eq $result -or $result.Count -eq 0) { Write-Output "No group found"; return }
foreach ($item in $result) { $item | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format 'yyyy-MM-dd HH:mm:ss') -PassThru -Force }
}
catch { throw }
}Unique ID of the group
Display name of the group
Unique ID of the tenant