I have some powershell to create a farm including the secure store service. The code is pretty straight forward:

Update-SPSecureStoreMasterKey -ServiceApplicationProxy $id -Passphrase $passphrase

I dont get any errors but when I then try to create an application server key, thus:

Update-SPSecureStoreApplicationServerKey -ServiceApplicationProxy $id -Passphrase $passphrase

it fails and tells me the master key is not found:

Update-SPSecureStoreApplicationServerKey : Master secret key is not present in the database.

The thing is, this doesnt always fail. It's seems rather unreliable.

Anyone got a workaround or any clever ideas?



I ran into this same issue. I'm embarrased to admit I stopped investigating when I found that Start-Sleep 5 seemed a reliable workaround.

Update-SPSecureStoreMasterKey -ServiceApplicationProxy $ssProxy -Passphrase xxx > $null
Start-Sleep 5
Update-SPSecureStoreApplicationServerKey -ServiceApplicationProxy $ssProxy -Passphrase xxx > $null
Start-Sleep 5

I guess theres a missing save/update/flush somewhere in those Cmdlets.

Not really a reasonable answer for a production quality solution but in my case I was trying to automate installation of our product for internal test purposes so a few sleeps were not a show-stopper.

  • We have the same issue with SP 2019 (at least in the case of the preview version). This workaround, waiting simply a few seconds, seems not to work in this case, but the solution proposed by @Davos helped us.
    – pholpar
    May 24 '19 at 8:48

"ChangeMasterSecretKey" from the instance of "Microsoft.Office.SecureStoreService.Server.SecureStoreServiceApplication" fixed the issue for me: SharePoint 2016 - Secure Store - MasterKey cannot be set! Problem Solved

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.