Skip to content

Instantly share code, notes, and snippets.

@nicolonsky
Last active May 10, 2020 21:03
Show Gist options
  • Save nicolonsky/e3f94acd49d51ab66ca3a4c9a7ce37a8 to your computer and use it in GitHub Desktop.
Save nicolonsky/e3f94acd49d51ab66ca3a4c9a7ce37a8 to your computer and use it in GitHub Desktop.
Create Azure AD App Registration Client Credential Certificate
$displayName = "Microsoft Graph PowerShell Client Credentials"
$notAfter = $(Get-Date).AddYears(1)
$cert = New-SelfSignedCertificate -CertStoreLocation cert:\currentuser\my -DnsName graph.microsoft.com -Provider "Microsoft Enhanced RSA and AES Cryptographic Provider" -NotAfter $notAfter -FriendlyName $displayName
$export = Export-Certificate -Cert "cert:\currentuser\my\$($cert.Thumbprint)" -FilePath "c:\temp\$displayName.cer"
Write-Output "Exported certificate '$($cert.Thumbprint)' to '$($export.FullName)'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment