Skip to content

Instantly share code, notes, and snippets.

@pkbullock
Created July 31, 2020 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pkbullock/359dce83b35317fa459ca6fc0bba90be to your computer and use it in GitHub Desktop.
Save pkbullock/359dce83b35317fa459ca6fc0bba90be to your computer and use it in GitHub Desktop.
Setting up Azure AD App for use with SharePoint
$Tenant = "yourtenant.onmicrosoft.com"
$AppName = "PnP-PowerShell Automation Example",
$CertificatePassword = "1234", # <-- Use a better one than this, nice a super complex
$ValidForYears = 2,
$CertCommonName = "PnP-PowerShell Automation Example",
$location = Get-Location # Get the location of the script to copy the script locally
Initialize-PnPPowerShellAuthentication -ApplicationName $AppName -Tenant $Tenant -OutPath $location `
-CertificatePassword (ConvertTo-SecureString -String $CertificatePassword -AsPlainText -Force) -ValidYears $ValidForYears `
-CommonName $CertCommonName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment