If you’ve tried creating a provider hosted app for SharePoint 2013 on-prem (not in Office 365) you know you likely need to go through some gyrations to set it up for high trust using the server-to-server (S2S) protocol. There’s a great article on MSDN that walks you through the details of this (linked below), but it’s a pain to have to type all that. Hopefully Visual Studio 2012’s SharePoint 2013 & Office 2013 Developer Tools will make our lives easier when we get to RTM, but for now in Beta 2 / Preview, I find it to be a pain.
That script required you to create & export the self-signed certificate (.cer) and associated private key (.pfx) using IIS. I always intended to script out the whole thing with Windows PowerShell… and now it’s finally done. Here’s what I added to the script:
Update (December, 20, 2014): I finally got around to updating my scripts… I deleted the old script I had here on my site & have added the following two. The first one will create a self-signed certificate which you can use in your local dev. The second one will setup an STS for S2S.
This generates the following…
You can see from the first line in the screenshot what you need to pass in to get this to work. If you look at the header in the script you’ll see a list of all the parameters and sample values. The script also lets you specify the certificate to use rather than letting it create one for you.
Introducing the first installment to Critical Path Training’s SharePoint 2013 Script Library. This is located in the Critical Path Training Members section of our site, specifically in the Code Samples section. A login is required, but it’s free to set one up. The script PrepareS2SApp.ps1 does almost everything for you.comments powered by Disqus