New-PnPAzureCertificate

Generate a new 2048bit self-signed certificate and manifest settings for use when using CSOM via an app-only ADAL application.

See https://github.com/SharePoint/PnP-PowerShell/tree/master/Samples/SharePoint.ConnectUsingAppPermissions for a sample on how to get started.

KeyCredentials contains the ADAL app manifest sections.

Certificate contains the PEM encoded certificate.

PrivateKey contains the PEM encoded private key of the certificate.

Syntax

New-PnPAzureCertificate
   [-CommonName <String>]
                          [-Country <String>]
                          [-State <String>]
                          [-Locality <String>]
                          [-Organization <String>]
                          [-OrganizationUnit <String>]
                          [-Out <String>]
                          [-ValidYears <Int>]
                          [-CertificatePassword <SecureString>]

Examples

------------------EXAMPLE 1------------------

New-PnPAzureCertificate

This will generate a default self-signed certificate named "pnp.contoso.com" valid for 10 years.

------------------EXAMPLE 2------------------

New-PnPAzureCertificate -CommonName "My Certificate" -ValidYears 30

This will output a certificate named "My Certificate" which expires in 30 years from now.

Parameters

-CertificatePassword

Optional certificate password

Type:SecureString
Position:8
Accept pipeline input:False
Accept wildcard characters:False
-CommonName

Common Name (e.g. server FQDN or YOUR name) [pnp.contoso.com]

Type:String
Position:0
Accept pipeline input:False
Accept wildcard characters:False
-Country

Country Name (2 letter code)

Type:String
Position:1
Accept pipeline input:False
Accept wildcard characters:False
-Locality

Locality Name (eg, city)

Type:String
Position:3
Accept pipeline input:False
Accept wildcard characters:False
-Organization

Organization Name (eg, company)

Type:String
Position:4
Accept pipeline input:False
Accept wildcard characters:False
-OrganizationUnit

Organizational Unit Name (eg, section)

Type:String
Position:5
Accept pipeline input:False
Accept wildcard characters:False
-Out

Filename to write to, optionally including full path (.pfx)

Type:String
Position:6
Accept pipeline input:False
Accept wildcard characters:False
-State

State or Province Name (full name)

Type:String
Position:2
Accept pipeline input:False
Accept wildcard characters:False
-ValidYears

Number of years until expiration (default is 10, max is 30)

Type:Int
Position:7
Accept pipeline input:False
Accept wildcard characters:False