Edit

Share via


Set-EntraUserSponsor

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

Syntax

SetUserSponsor (Default)

Set-EntraUserSponsor

    -UserId <String>
    -Type <String>
    -SponsorIds <String[]>
    [<CommonParameters>]

Description

The Set-EntraUserSponsor cmdlet sets 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.

Update-EntraUserSponsor is an alias for Set-EntraUserSponsor.

In delegated scenarios with work or school accounts, the signed-in user must have a supported Microsoft Entra role or a custom role that includes the microsoft.directory/users/sponsors/update permission.

The following least privileged roles support this operation:

  • Directory Writers
  • User Administrator

Examples

Example 1: Assign single user sponsor

Connect-Entra -Scopes 'User.ReadWrite.All'
$sponsor = Get-EntraUser -UserId 'SponsorEmail@contoso.com'
Set-EntraUserSponsor -UserId 'JohnstoneH@fabrikam.com' -Type User -SponsorIds $sponsor.Id

This example demonstrates how to assign a single user, as a sponsor to a target user account.

  • The -UserId parameter specifies the User ID or User Principal Name. You can use -UserPrincipalName, -Identity, -UPN, -ObjectId as an alias for -UserId.
  • The -Type parameter specifies the type of sponsor being assigned to the user. Supported sponsor types are (User or Group).
  • The -SponsorIds parameter specifies the Ids of sponsors to be assigned to the user.

Example 2: Assign single group sponsor

Connect-Entra -Scopes 'User.ReadWrite.All', 'GroupMember.Read.All'
$group = Get-EntraGroup -SearchString 'Sales and Marketing'
Set-EntraUserSponsor -UserId 'JohnstoneH@fabrikam.com' -Type Group -SponsorIds $group.Id

This example demonstrates how to assign a single group, as a sponsor to a target user account.

  • The -UserId parameter specifies the User ID or User Principal Name. You can use -UserPrincipalName, -Identity, -UPN, -ObjectId as an alias for -UserId.
  • The -Type parameter specifies the type of sponsor being assigned to the user. Supported sponsor types are (User or Group).
  • The -SponsorIds parameter specifies the Ids of sponsors to be assigned to the user.

Example 3: Assign multiple user sponsors

Connect-Entra -Scopes 'User.ReadWrite.All'
Set-EntraUserSponsor -UserId 'JohnstoneH@fabrikam.com' -Type User -SponsorIds @("db0c6l50-93ee-4b22-9bb9-c8454875d990","c9db38b9-e5b8-4b5e-ak78-9812230af58d")

This example demonstrates how to assign multiple users as sponsors to a target user account.

  • The -UserId parameter specifies the User ID or User Principal Name. You can use -UserPrincipalName, -Identity, -UPN, -ObjectId as an alias for -UserId.
  • The -Type parameter specifies the type of sponsor being assigned to the user. Supported sponsor types are (User or Group).
  • The -SponsorIds parameter specifies the Ids of sponsors to be assigned to the user.

Example 4: Assign multiple group sponsors

Connect-Entra -Scopes 'User.ReadWrite.All'
Set-EntraUserSponsor -UserId 'JohnstoneH@fabrikam.com' -Type Group -SponsorIds @("db0c6f50-93ee-4b22-9bb9-c8454875d990","c9db38b9-e5v8-4b5e-ae78-9812230af58d")

This example demonstrates how to assign multiple groups as sponsors to a target user account.

  • The -UserId parameter specifies the User ID or User Principal Name. You can use -UserPrincipalName, -Identity, -UPN, -ObjectId as an alias for -UserId.
  • The -Type parameter specifies the type of sponsor being assigned to the user. Supported sponsor types are (User or Group).
  • The -SponsorIds parameter specifies the Ids of sponsors to be assigned to the user.

Parameters

-SponsorId

Specifies the sponsor ID (user or group ID) to assign to the specific user target.

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

-Type

Specifies the type of sponsors being assigned to the user. Supported sponsor types are (User or Group).

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

-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.