SharePoint 2013 Domain Certificate for Provider-Host App Development Environment

Creating Self-Signed (domain) Certificate for Provider-Hosted App


This is the certificate that will be used on the IIS site to make it SSL enabled site.  It’s different from the one to create the STS Security token.  If the certificate is not created with proper domain associated, you’ll have issues with calling the App Event Receivers.  To create the certificate and set it up on IIS, following the instruction below:

  1. Open Visual Studio Developer Command Prompt and type the following command

makecert -r -pe -n "CN=spapps.rchen.com" -b 01/01/2013 -e 01/11/2015 -eku 1.3.6.1.5.5.7.3.1 -ss my -sr localMachine -sky exchange -sy 12 -sp "Microsoft RSA SChannel Cryptographic Provider" "D:\ Certs\SPAppCert.cer"


certmgr /add " D:\ Certs\SPAppCert.cer " /s /r localMachine root

*** You need to replace the domain (spapps.rchen.com) with your domain and the file path for the new certificate.

  1. Open MMC.exe and add Certificates snap-in
    1. Copy the new certificate from “Personal/Certificates” folder to “Trusted Root Certification Authorities/Certificates” folder.

  1. Open IIS Manager
    1. Verify your domain certificate is added
    2. Bind it to your IIS site
  2. Add to SharePoint Trust Root Authority through Central Admin
    1. Security -> Managed Trust -> New
    2. Enter name and browse to the certificate. Click OK

Errors for Invalid Certificate

If your certificate isn't for correct domain or is invalid, you'll likely get the following errors.

Event Viewer

An operation failed because the following certificate has validation errors:

Subject Name: CN=server.domain
Issuer Name: CN= server.domain
Thumbprint: C1E2B38AC0D7F56AEA8906FFA2060AF4E67071E7

Errors:

 SSL policy errors have been encountered.  Error code '0x2'..

ULS Log


12/10/2013 09:36:28.74 OWSTIMER.EXE (0x3CF4)                     0x30B8 SharePoint Foundation              Topology                                  8311     Critical  An operation failed because the following certificate has validation errors:  Subject Name: CN= server.domain Issuer Name: CN= server.domain Thumbprint: B75C19AA3D4CCE373AF8C86D8525212464A6BFF6  Errors:   SSL policy errors have been encountered.  Error code '0x6'..            6d253d23-f72f-4173-a9a6-79aeaab7e557

12/10/2013 09:36:28.74 OWSTIMER.EXE (0x3CF4)                     0x30B8 SharePoint Foundation              Dev Events                                ajmb6   High    Calling remote event receiver failed. URL = [https://siteUrl/Branding/Services/AppEventReceiver.svc], App Identifier = [i:0i.t|ms.sp.ext|904aa6d3-df40-4d3f-9c09-9880e54ff978@ff5b3346-91e8-4dc3-926d-25c3116cfba6], Event Type = [AppInstalled], Exception = [Could not establish trust relationship for the SSL/TLS secure channel with authority 'spapps.rchen.com'.]     6d253d23-f72f-4173-a9a6-79aeaab7e557


*Note: if your environment does not have Visual Studio installed, you can use the following command from another computer to generate the .cer and .pfx files for another server.

makecert -r -pe -n "CN=spapps.rchen.com" -b 01/01/2013 -e 01/11/2017 -sky exchange -sy 12 -sp "Microsoft RSA SChannel Cryptographic Provider" -sv "D:\Certs\SPAppCert.pvk" "D:\Certs\SPAppCert.cer"

pvk2pfx -pvk "D:\SSLCerts\spapps.rchen.com.pvk" -spc "D:\Certs\SPAppCert.cer" -pfx "D:\Certs\SPAppCert.pfx" -pi "Password1"

Manually import into MMC snap-in and IIS site

Comments

Unknown said…
Incredible blog to read.
Sara Smith said…
Hi there, Hope you all are doing well. I simply want to give a immense thumbs up for the quality data you have right here on this post. I will likely be coming again to your weblog for more soon. I will recommend this blog to all those who want to learn about SharePoint.

Also I Want to Share With You 23 Best Dental Websites Build by OptiMized360.

Popular posts from this blog

SharePoint 2013 App Details Page Error

SharePoint 2013 - Working with Display Template for Content Search Web Part

Add spell check dictionary in SharePoint 2010, SharePoint 2013, and Office 365