Create a new Service Application Proxy Group with New-SPServiceApplicationProxyGroup

I believe one of the much overlooked features available to administrator when configuring SharePoint service applications is the ability to create new service application proxy groups. Out of the box, web applications can have service applications assigned to them by virtue of the default proxy group or the [custom] proxy group.

Unfortunately there is no UI for creating new proxy groups or assigning service applications proxies to proxy groups. So we use PowerShell – obviously!

To create a new proxy group is simple, the example below create a new proxy group called ‘MultiTenant':

New-SPServiceApplicationProxyGroup "MultiTenant"

This results in the following becoming available to us when we are assigning web applications to service connections:

image

So far so good… However, you’ll notice that this proxy group does not have any service application proxies assigned to it. To assign service application proxies to this new group we use Add-SPServiceApplicationProxyGroupMember. The following example adds the Access Services service application proxy to the newly create MultiTenant proxy group:

$serviceAppProxy = Get-SPServiceApplicationProxy | where { $_.Name -eq "Access Services" }
Add-SPServiceApplicationProxyGroupMember "MultiTenant" -Member $serviceAppProxy

The above results in the Access Services proxy being assign to the MultiTenant proxy group:

image

To remove service application proxies from proxy groups is just as simple:

Remove-SPServiceApplicationProxyGroupMember "MultiTenant" -Member $serviceAppProxy

Using the above three commands, New-SPServiceApplicationProxyGroup, Add-SPServiceApplicationProxyGroupMember  and Remove-SPServiceApplicationProxyGroupMember you can quickly define and control your very own proxy groups and assign them to your web apps.

Happy configuring…

About these ads

6 Responses to Create a new Service Application Proxy Group with New-SPServiceApplicationProxyGroup

  1. Pingback: Creating a new Service Application Proxy Group in SharePoint 2010 | David Lozzi's Blog

  2. Ken says:

    I’m working on a ps script to provision a new enterprise Search Service application, add it and other service applications to a proxy group as discribed in your post, then assign this proxy group to a web application. Everything is working except I cannot set the default search application using PowerShell.

    This functionality is available through Central Admin (/_admin/ApplicationAssociationsDialog.aspx) when you have 2 service applications of the same type in a proxy group, and the link “[set as default]” appears to the right of the service application’s name.

    The DefaultProxies member of SPServiceApplicationProxyGroup appears to be read-only.

    How can I set the default proxy in powershell?

    Thanks for your help.

    • briancartmel says:

      Hi Ken,

      That’s a good question… I’ll see what I can find out…

    • briancartmel says:

      Hi Ken,

      When you click on [Set as default] in the service application proxy selection screen, this calls an internal method on SPServiceApplicationProxyGroup called ‘SetDefaultProxy’.

      Unfortunately as this method is internal it cannot be easily reached with PowerShell or the OM.

      Can you describe in what scenario you need 2 search service applications assigned to the same proxy group and therefore web application?

      Regards,

      Brian C

      • Ken says:

        Thanks for your quick reply. The scenario should be fairly common. We want to provision a dedicated search service application for one web app in our farm, and leave the “Search Service Application and other service apps in the default group to service the other web apps.

        My approach is to create the new dedicated search service application, loop through and add all proxies to my new group, then remove the “default” search application. However, when I call “Remove-SPServiceApplicationProxyGroupMember” the default service application remains in the proxy group, but is “unchecked” in CA. We noticed that the new dedicated search app doesn’t work until we go back in to CA and click “set as default”

        #(creating new search service application above here)

        $groupName = “NewServiceAppProxyGroup”
        New-SPServiceApplicationProxyGroup $groupName
        $allservices = Get-SPServiceApplicationProxy
        $allservices | ForEach-Object{ Add-SPServiceApplicationProxyGroupMember $groupName -Member $_}
        $defaultSearch = Get-SPServiceApplicationProxy | where { $_.Name -eq “Search Service Application” }
        Remove-SPServiceApplicationProxyGroupMember $groupName -Member $defaultSearch
        $newProxygroup = Get-SPServiceApplicationProxyGroup $groupName
        $webApp = Get-SPWebApplication -Identity “WebAppToHaveDedicatedSearch”
        $webApp.ServiceApplicationProxyGroup = $newProxygroup
        $webApp.Update()

        I will modify my script to only add the appropriate search service instead of adding both then “removing” one to see if that does the trick.

  3. Ken says:

    That did the trick. By never adding 2 service application proxies of the same type, I allieviated the need to “set as default”

    #(creating new search service application above here)

    $groupName = “NewServiceAppProxyGroup”
    New-SPServiceApplicationProxyGroup $groupName
    $allservices = Get-SPServiceApplicationProxy | where { $_.Name -ne “Search Service Application” }
    \ $allservices | ForEach-Object{ Add-SPServiceApplicationProxyGroupMember $groupName -Member $_}
    $newProxygroup = Get-SPServiceApplicationProxyGroup $groupName
    $webApp = Get-SPWebApplication -Identity “WebAppToHaveDedicatedSearch”
    $webApp.ServiceApplicationProxyGroup = $newProxygroup
    $webApp.Update()

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: