Set-MsolServicePrincipal
Updated: July 30, 2015
Applies To: Azure, Office 365, Windows Intune
Note
- The cmdlets were previously known as the Microsoft Online Services Module for Windows PowerShell cmdlets.
The Set-MsolServicePrincipal cmdlet updates a service principal in . It can be used to update the display name, enable/disable the service principal, the service principal names (SPNs) or the addresses.
Syntax
Set-MsolServicePrincipal [-AccountEnabled <Boolean>] [-Addresses <Address[]>] [-DisplayName <string>] [-ServicePrincipalNames <string[]>] [-TenantId <Guid>] [<CommonParameters>]
Set-MsolServicePrincipal -ObjectId <Guid> [-Addresses <Address[]>] [-ServicePrincipalNames <string[]>] [-TenantId <Guid>] [<CommonParameters>]
Set-MsolServicePrincipal -AppPrincipalId <GUID> [-Addresses <Address[]>] [-ServicePrincipalNames <string[]>] [-TenantId <Guid>] [<CommonParameters>]
Parameters
-AccountEnabled <Boolean>
This property is reserved for future use.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Addresses <Address[]>
Specify the addresses list to update (and overwrite) the existing list
with. If this is set to NULL, the existing property will not be
updated. If this is set to an empty list, the existing Addresses will
be cleared. Use the New-MsolServicePrincipalAddress cmdlet to help
create the Addresses list object.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-AppPrincipalId <GUID>
The unique application identifier associated with the service
principal to be updated.
Required? true
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-DisplayName <string>
The friendly name of the service principal.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ObjectId <Guid>
The object ID associated with the service principal to be updated.
Required? true
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-ServicePrincipalNames <string[]>
Specify the service principal names (SPNs) list to update (and
overwrite) the existing list with. If this is set to NULL, the
existing property will not be updated. If this is set to an empty
list, the existing SPNs will be cleared, except for the SPN containing
the service principal's AppId value.
An SPN must use one of the following formats "appName" or
"appName/hostname" or be a valid URL.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-TenantId <Guid>
The unique ID of the tenant to perform the operation on. If this is
not provided, then the value will default to the tenant of the current
user. This parameter is only applicable to partner users.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information,
see
about_CommonParameters
(https://go.microsoft.com/fwlink/?LinkID=113216).
Examples
The following examples demonstrate the usage of this cmdlet.
Example 1
The following command updates properties on the specified service principal. In this example, it specifies updates to the display name and the service principal names. This will overwrite any previous settings.
$AppId = (Get-MsolServicePrincipal -ServicePrincipalName "MyApp").AppPrincipalId
Set-MsolServicePrincipal -AppPrincipalId $AppId -DisplayName "My Super Application" -ServicePrincipalNames @("MyApp/Contoso.com", "MyApp/Fabrikam.com")
Example 2
The following command updates a service principal's associated addresses. In this example, existing Addresses that were previously created ("Contoso.com", "Fabrikam.com") using the New-MsolServicePrincipalAddress helper command, are associated with the service principal. The following command updates properties on the specified service principal. In this example, it specifies updates to the display name and the service principal names. This will overwrite any previous settings.
$a = @()
$a = $a + (Get-MsolServicePrincipal -ServicePrincipalName "MyApp").Addresses
$a = $a + (New-MsolServicePrincipalAddress -Value "Contoso.com")
$a = $a + (New-MsolServicePrincipalAddress -Value "Fabrikam.com")
Set-MsolServicePrincipal -AppPrincipalId $AppId -Addresses $a
Additional Resources
There are several other places you can get more information and help. These include: