Muokkaa

Jaa


Set-MsolServicePrincipal

Updates a service principal in Microsoft Azure Active Directory.

Syntax

Set-MsolServicePrincipal
   [-ObjectId <Guid>]
   [-AppPrincipalId <Guid>]
   [-DisplayName <String>]
   [-ServicePrincipalNames <String[]>]
   [-AccountEnabled <Boolean>]
   [-Addresses <RedirectUri[]>]
   [-TenantId <Guid>]
   [<CommonParameters>]

Description

The Set-MsolServicePrincipal cmdlet updates a service principal in Microsoft Azure Active Directory. It can be used to update the display name, enable/disable the service principal, trusted for delegation, the service principal names (SPNs) or the addresses.

Examples

Example 1: Change properties on a service principal

PS C:\> $AppId = (Get-MsolServicePrincipal -ServicePrincipalName "MyApp").AppPrincipalId
PS C:\> Set-MsolServicePrincipal -AppPrincipalId $AppId -DisplayName "My Super Application" -ServicePrincipalNames @("MyApp/myapp.com", "MyApp/mysuperapp.com")

This command updates properties on the specified service principal. In this example, it specifies updates to the display name and the SPNs. This will overwrite any previous settings.

Example 2: Change addresses on a service principal

PS C:\> $a = @()
PS C:\> $a = $a + (Get-MsolServicePrincipal -ServicePrincipalName "MyApp").Addresses
PS C:\> $a = $a + (New-MsolServicePrincipalAddresses -Value "myApp1.com")
PS C:\> $a = $a + (New-MsolServicePrincipalAddresses -Value "myApp2.com")
PS C:\> Set-MsolServicePrincipal -AppPrincipalId $AppId -Addresses $a

This command updates the addresses of a service principal. In this example, existing Addresses that were previously created ("myApp1.com", "myApp2.com") using the New-MsolServicePrincipalAddresses cmdlet, are associated with the service principal.

Parameters

-AccountEnabled

This property is reserved for future use.

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

-Addresses

Specifies the addresses list with which to update and overwrite the existing list. If you do not specify this parameter, the existing property is not updated. If you specify an empty list, the existing addresses are cleared. Use the New-MsolServicePrincipalAddress cmdlet to help create the Addresses list object.

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

-AppPrincipalId

Specifies the unique application ID that is associated with the service principal to update.

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

-DisplayName

Specifies the display name of the service principal.

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

-ObjectId

Specifies the unique object ID of the service principal to update.

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

-ServicePrincipalNames

Specifies the list of SPNs with which to update and overwrite the existing. If you do not specify this parameter, the existing property is not updated. If you specify an empty list, the existing SPNs are cleared, except for the SPN that contains the AppId value of the service principal. An SPN must use one of the following formats:

  • appName
  • appName/hostname
  • a valid URL
Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-TenantId

Specifies the unique ID of the tenant on which to perform the operation. The default value is the tenant of the current user. This parameter applies only to partner users.

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