question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SPUserProfileServiceApp: does not execute New-SPProfileServiceApplicationProxy

See original GitHub issue

Details of the scenario you tried and the problem that is occurring

The code in Set-TargetResource of resource SPUserProfileServiceApp is flawed, current logic never executes New-SPProfileServiceApplicationProxy:

$serviceApps = Get-SPServiceApplication -Name $params.Name `
                                                    -ErrorAction SilentlyContinue
$app = $serviceApps | Select-Object -First 1
if ($null -eq $serviceApps)
{
    New-SPProfileServiceApplication @params | Out-Null
    if ($null -ne $app)
    {
        New-SPProfileServiceApplicationProxy -Name $pName `
                                             -ServiceApplication $app `
                                             -DefaultProxyGroup
    }

    $app = Get-SPServiceApplication -Name $params.Name `
                                    -ErrorAction SilentlyContinue
}

Verbose logs showing the problem

There is nothing specific in the logs, cmdlet New-SPProfileServiceApplicationProxy is just never called

Suggested solution to the issue

At minimum it should changed to correctly assign $app to the result of New-SPProfileServiceApplicationProxy, but it can also be simplified:

$app = Get-SPServiceApplication -Name $params.Name `
                                -ErrorAction SilentlyContinue
if ($null -eq $app)
{
    $app = New-SPProfileServiceApplication @params
    if ($null -ne $app)
    {
        New-SPProfileServiceApplicationProxy -Name $pName `
                                             -ServiceApplication $app `
                                             -DefaultProxyGroup
    }
}

I’ll submit a PR with that change soon

The DSC configuration that is used to reproduce the issue (as detailed as possible)

Any configuration reproduces the issue:

SPUserProfileServiceApp UserProfileServiceApp
{
    Name                 = $UpaServiceName
    ApplicationPool      = $ServiceAppPoolName
    MySiteHostLocation   = "http://$MySiteHostAlias/"
    ProfileDBName        = $SPDBPrefix + "UPA_Profiles"
    SocialDBName         = $SPDBPrefix + "UPA_Social"
    SyncDBName           = $SPDBPrefix + "UPA_Sync"
    EnableNetBIOS        = $false
    PsDscRunAsCredential = $SPSetupCredsQualified
    DependsOn            = "[SPServiceAppPool]MainServiceAppPool", "[SPServiceInstance]UPAServiceInstance", "[SPSite]MySiteHost"
}

The operating system the target node is running

OsName               : Microsoft Windows Server 2016 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture       : 64-bit
WindowsBuildLabEx    : 14393.2214.amd64fre.rs1_release_1.180402-1758
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

Version of SharePoint that is used (e.g. SharePoint 2016)

I reproduced with SharePoint 2016, I expect it to be exactly the same with SharePoint 2013

Version and build of PowerShell the target node is running

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.14393.2214
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.2214
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Version of the DSC module that was used (‘dev’ if using current dev branch)

SharePointDSC 2.5.0.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
ykuijscommented, Nov 2, 2018

Totally agree. Have implemented a fix and will submit the PR shortly.

0reactions
Yvandcommented, Oct 26, 2018

This test looks useless to me: https://github.com/PowerShell/SharePointDsc/blob/88802efdeab51171182d1df58b53cfcdb99253e1/Modules/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.psm1#L409-L414 For 2 reasons:

About Set-SPServiceApplicationSecurity, I assume it makes all the changes in the $app passed, so $app is up to date when cmdlet returns. I understand your point though, so I could be wrong

Read more comments on GitHub >

github_iconTop Results From Across the Web

User Profile service application doesn't work - SharePoint
Provides a workaround for an issue in which the User Profile service application doesn't work. This issue occurs after a SharePoint farm is ......
Read more >
New-SPProfileServiceApplicationProxy (sharepoint-server)
Creates a User Profile Service application proxy on the local farm. In this article. Syntax; Description; Examples; Parameters. Syntax. PowerShell
Read more >
SharePoint: A Troubleshooting Guide for ... - Josh Roark
Trying to access the User Profile Service Application within Central Administration fails with “An unexpected error has occurred”; Missing “ ...
Read more >
Create User Profile Service Application using PowerShell ...
Looking to create a User Profile Service Application in SharePoint 2016? ... Once the script execution is completed successfully, you can go ...
Read more >
Cannot create user profile service... ...
Few possible reasons,. 1) your logged in user does not have correct privileges. 2) check for same GUID displayed in ULS logs or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found