Get-AzADGroup

Lists entities from groups or get entity from groups by key

Syntax

Get-AzADGroup
   [-Count]
   [-Expand <String[]>]
   [-Select <String[]>]
   [-Filter <String>]
   [-Orderby <String[]>]
   [-Search <String>]
   [-ConsistencyLevel <String>]
   [-First <UInt64>]
   [-Skip <UInt64>]
   [-AppendSelected]
   [-DefaultProfile <PSObject>]
   [-CountVariable <String>]
   [<CommonParameters>]
Get-AzADGroup
   [-Expand <String[]>]
   [-Select <String[]>]
   [-ConsistencyLevel <String>]
   [-First <UInt64>]
   [-Skip <UInt64>]
   [-AppendSelected]
   -DisplayName <String>
   [-DefaultProfile <PSObject>]
   [<CommonParameters>]
Get-AzADGroup
   [-Expand <String[]>]
   [-Select <String[]>]
   [-ConsistencyLevel <String>]
   [-First <UInt64>]
   [-Skip <UInt64>]
   [-AppendSelected]
   -DisplayNameStartsWith <String>
   [-DefaultProfile <PSObject>]
   [<CommonParameters>]
Get-AzADGroup
   [-Expand <String[]>]
   [-Select <String[]>]
   [-ConsistencyLevel <String>]
   [-AppendSelected]
   -ObjectId <Guid>
   [-DefaultProfile <PSObject>]
   [<CommonParameters>]

Description

Lists entities from groups or get entity from groups by key

Examples

Example 1: Get group by display name

Get-AzADGroup -DisplayName $gname

Get group by display name

Example 2: List groups

Get-AzADGroup -First 10

List first 10 groups

Example 3: Get group by object id

Get-AzADGroup -ObjectId $id -Select groupTypes -AppendSelected

Get group by object id and append property 'groupTypes' after default properties: 'DisplayName', 'Id', 'DeletedDateTime', 'SecurityEnabled', 'MailEnabled', 'MailNickname', 'Description'

Example 4: Get group with filter

Get-AzADGroup -Filter "startsWith(DisplayName,'some-name')"

Get group with filter

Example 5: Assign OdataCount to a variable

Get-AzADGroup -First 10 -ConsistencyLevel eventual -Count -CountVariable 'result'
$result

Assign OdataCount to a variable

Parameters

-AppendSelected

Append properties selected with default properties when this switch is on, only works with parameter '-Select'.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ConsistencyLevel

Indicates the requested consistency level. Documentation URL: https://developer.microsoft.com/en-us/office/blogs/microsoft-graph-advanced-queries-for-directory-objects-are-now-generally-available/

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Count

Include count of items

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-CountVariable

Specifies a count of the total number of items in a collection. By default, this variable will be set in the global scope.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:PSObject
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DisplayName

The display name of the group.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-DisplayNameStartsWith

Used to find groups that begin with the provided string.

Type:String
Aliases:SearchString
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Expand

Expand related entities

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Filter

Filter items by property values, for more detail about filter query please see: https://video2.skills-academy.com/en-us/graph/filter-query-parameter

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-First

Gets only the first 'n' objects.

Type:UInt64
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ObjectId

key: id of group

Type:Guid
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Orderby

Order items by property values

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Search items by search phrases

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Select

Select properties to be returned

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Skip

Ignores the first 'n' objects and then gets the remaining objects.

Type:UInt64
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

IMicrosoftGraphGroup

Notes

ALIASES