How To Create the UPA from Powershell

Creating the User Profile Service Application (UPA) via Powershell is a fairly straightforward process. We only have to follow these steps:

  1. Set Parameters
  2. Create the Service Application
  3. Create the Service Application Proxy and associate it to the Proxy Group
  1. Set Parameters: First of all we have to set the parameters we will use for the service application.
  • Name for your User Profile Service Application
  • $UPAName = “70331_UserProfile”
  • Application Pool: You can create a specific one or use an existing one. I recommend to use the same Application Pool for all service applications. In my case, I am assigning the existing application pool called “ServiceApplications” to the $appPool variable:
  • $AppPool = Get-SPServiceApplicationPool –Identity “ServiceApplications”
  • Database Names: UPA uses three distinct databases: Profile, Social and Profile. Try to follow the convention rule you have for your farm databases. $SocialDB = “70331_UserProfile_SocialDB”
  • $SyncDB = “70331_UserProfile_SyncDB”
  • $ProfileDB = “70331_UserProfile_ProfileDB”
  • Proxy Name: Type a name for the Proxy/connection of the UPA
  • $UPAProxy = “70331_UPA_Proxy”
  1. Create the Service Application: Use the New-SPProfileServiceApplication cmdlet for this purpose and use the recently created parameters and collect the result in the $UPA variable so as to use it later in the Proxy creation.

$UPA=New-SPProfileServiceApplication -Name $UPAName -ApplicationPool $appPool -ProfileDBName $ProfileDB -SocialDBName $SocialDB -ProfileSyncDBName $SyncDB

  1. Create the Service Application Proxy: Use the New-SPProfileServiceApplicationProxy cmdlet and the parameters configured above. Use the option DefaultProxyGroup if you want to include the proxy into the default group.

New-SPProfileServiceApplicationProxy -Name $UPAProxy -ServiceApplication $UPA –DefaultProxyGroup

  1. If you did not associate the user profile proxy to the default proxy group and you want to associate it to a custom one, do the following:

#Get the list of Proxy Groups and copy the Friendly Name of the Proxy group you need.

Get-SPServiceApplicationProxyGroup

$proxyGroup=Get-SPServiceApplicationProxyGroup -Identity “Intranet Only”

#Get the list of proxies/connections, copy the typename of the UPA proxy and use it for assigning it to the $proxy variable

$proxy=Get-SPServiceApplicationProxy | ? {$_.TypeName -eq “User Profile Service Application Proxy”}

#Use the Add-SPServiceApplicationProxyGroupMember cmdlet to add the UPA proxy to your custom ProxyGroup

Add-SPServiceApplicationProxyGroupMember -Identity $proxygroup -Member $Proxy

That´s all, hope it helps!

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s