Edit

Share via


Get-EntraUserSponsor

Retrieve a user's sponsors (users or groups).

Syntax

GetQuery

Get-EntraUserSponsor

    -UserId <String>
    [-All]
    [-Filter <String>]
    [-Top <Int32>]
    [-Property <String[]>]
    [<CommonParameters>]

GetById

Get-EntraUserSponsor

    -UserId <String>
    -SponsorId <String>
    [-All]
    [-Property <String[]>]
    [<CommonParameters>]

Description

The Get-EntraUserSponsor cmdlet retrieve a user's sponsors (users or groups). The sponsor feature tracks who is responsible for each guest user by assigning a person or group, ensuring accountability.

In delegated scenarios with work or school accounts, the signed-in user needs a supported Microsoft Entra role or a custom role with microsoft.directory/users/sponsors/read permission. The least privileged supported roles are:

  • Guest Inviter
  • Directory Readers
  • Directory Writers
  • User Administrator

Examples

Example 1: Get the user sponsors

Connect-Entra -Scopes 'User.Read.All'
Get-EntraUserSponsor -UserId 'SawyerM@contoso.com' -All |
Select-Object Id, DisplayName, '@odata.type', CreatedDateTime | Format-Table -AutoSize
id                                   displayName                 @odata.type                createdDateTime
--                                   -----------                 -----------                ---------------
cccccccc-2222-3333-4444-dddddddddddd Angel Brown(Fabrikam)       #microsoft.graph.user      3/7/2024 3:10:31 AM
eeeeeeee-4444-5555-6666-ffffffffffff Fabrikam Helpdesk Group     #microsoft.graph.group     8/7/2024 2:52:47 PM

This example shows how to list user sponsors.

  • The -UserId parameter specifies the User ID or User Principal Name.

Example 2: Get top one sponsor

Connect-Entra -Scopes 'User.Read.All'
Get-EntraUserSponsor -UserId 'SawyerM@contoso.com' -Top 1 |
Select-Object Id, DisplayName, '@odata.type', CreatedDateTime | Format-Table -AutoSize
id                                   displayName                 @odata.type                createdDateTime
--                                   -----------                 -----------                ---------------
cccccccc-2222-3333-4444-dddddddddddd Angel Brown(Fabrikam)       #microsoft.graph.user      3/7/2024 3:10:31 AM

This example retrieves the top sponsor for the specified user. You can use -Limit as an alias for -Top.

  • The -UserId parameter specifies the User ID or User Principal Name.

Example 3: Retrieve the assigned sponsor for a specific user by their SponsorId

Connect-Entra -Scopes 'User.Read.All'
Get-EntraUserSponsor -UserId 'SawyerM@contoso.com' -SponsorId 'cccccccc-2222-3333-4444-dddddddddddd' |
Select-Object Id, DisplayName, '@odata.type', CreatedDateTime | Format-Table -AutoSize
id                                   displayName                 @odata.type                createdDateTime
--                                   -----------                 -----------                ---------------
cccccccc-2222-3333-4444-dddddddddddd Angel Brown(Fabrikam)       #microsoft.graph.user      3/7/2024 3:10:31 AM
eeeeeeee-4444-5555-6666-ffffffffffff Fabrikam Helpdesk Group     #microsoft.graph.group     8/7/2024 2:52:47 PM

This example retrieves the assigned sponsor for the specified user.

  • The -UserId parameter specifies the User ID or User Principal Name.
  • The -SponsorId parameter specifies the specific user's sponsor ID to retrieve (user or group ID).

Parameters

-All

List all pages.

Parameter properties

Type:System.Management.Automation.SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Filter

Specifies an OData v4.0 filter statement. This parameter controls which objects are returned.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

GetQuery
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-Property

Specifies properties to be returned.

Parameter properties

Type:

System.String[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:Select

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SponsorId

Specifies the specific user's sponsor ID to retrieve (user or group ID).

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-Top

Specifies the maximum number of records to return.

Parameter properties

Type:System.Int32
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Limit

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-UserId

Specifies the ID (as a UserPrincipalName or UserId) of a user in Microsoft Entra ID.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:ObjectId, UPN, Identity, UserPrincipalName

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.