8-Week Microsoft Teams AppDev Accelerator Program
Limited seats available! - Start date: Wednesday, April 16, 2025
Join Today & Save $1,000
articles

Time-Saving PowerShell Script for SharePoint 2013 Certs

As a SharePoint dev, I share my time-saving PowerShell script for registering self-signed certificates. Learn how to speed SharePoint 2013 on-prem app dev.

Time-Saving PowerShell Script for SharePoint 2013 Certs
by Andrew Connell

Last updated October 2, 2012
2 minutes read

Share this

Focus Mode

  • Feedback & questions

A while ago I posted a PowerShell script that I use to register a self-signed certificate that started out like this:

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 set up an STS for S2S.

This generates the following…

PowerShell Results

PowerShell Results

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.

Andrew Connell, Microsoft MVP, Full-Stack Developer & Chief Course Artisan - Voitanos LLC.
author
Andrew Connell

Microsoft MVP, Full-Stack Developer & Chief Course Artisan - Voitanos LLC.

Andrew Connell is a full stack developer who focuses on Microsoft Azure & Microsoft 365. He’s a 20+ year recipient of Microsoft’s MVP award and has helped thousands of developers through the various courses he’s authored & taught. Whether it’s an introduction to the entire ecosystem, or a deep dive into a specific software, his resources, tools, and support help web developers become experts in the Microsoft 365 ecosystem, so they can become irreplaceable in their organization.

Feedback & Questions

newsletter

Join 10,000+ developers for news & insights

No clickbait · 100% free · Unsubscribe anytime.

Subscribe to Andrew's newsletter for insights & stay on top of the latest news in the Microsoft 365 Space!
blurry dot in brand primary color
found this article helpful?

You'll love these!

SP2013 WCM: Forget Everything You Knew About SharePoint WCM

SP2013 WCM: Forget Everything You Knew About SharePoint WCM

July 16, 2012

Read now

Time-Saving PowerShell Script for SharePoint 2013 Certs

Time-Saving PowerShell Script for SharePoint 2013 Certs

October 2, 2012

Read now

bi-weekly newsletter

Join 10,000+ Microsoft 365 full-stack web developers for news, insights & resources. 100% free.

Subscribe to Andrew's newsletter for insights & stay on top of the latest news in the Microsoft 365 ecosystem!

No clickbait · 100% free · Unsubscribe anytime.

Subscribe to Andrew's newsletter for insights & stay on top of the latest news in the Microsoft 365 Space!