Issue
I expect this code to work:
# Configure global variables
$tenant = "<tenant>.onmicrosoft.com"
$spoRoot = "https://<tenant>.sharepoint.com/"
$certificatePassword = "cool-emu2" | ConvertTo-SecureString -Force -AsPlainText
# Initialize the AAD application to access Graph and SPO
$aadApp = Initialize-PnPPowerShellAuthentication `
-ApplicationName "Heinrich-TeamsProvisioning" `
-Tenant $tenant `
-Store CurrentUser `
-CommonName "TeamsProvisioning" `
-CertificatePassword $certificatePassword `
-ValidYears 2 `
-OutPath 'C:\temp\aad'
This is copied from a blog post from @PaoloPia over here: https://www.collabmagazine.com/provisioning-teams-in-microsoft-teams-using-the-pnp-provisioning-engine/
I get an error message:
Initialize-PnPPowerShellAuthentica
tion : The handle is invalid.
At line:7 char:11
+ $aadApp = Initialize-PnPPowerShellAuthentication `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Initialize-PnPPowerShellAuthentication], IOException
+ FullyQualifiedErrorId : System.IO.IOException,PnP.PowerShell.Commands.Base.InitializePowerShellAuthentication

(Note: that I am asked for my credentials and the certificate is created on my machine in c:\temp\aad.)
Run above code snippet.
3.25.2009.1
I'm also seeing this issue. Same version.
It does appear to have created the app registration and the certificate ok so expect it will work.
This issue occurs when running a script from the PowerShell ISE. We have just released a new version of PnP PowerShell (classic/for windows) which fixes this issue. We strongly advice you to move to VSCode for PowerShell Scripts as the PowerShell ISE is not actively maintained anymore : https://docs.microsoft.com/en-us/powershell/scripting/windows-powershell/ise/introducing-the-windows-powershell-ise?view=powershell-7#:~:text=The%20PowerShell%20ISE%20is%20no,in%20PowerShell%20v6%20and%20beyond
Hi All.
The script needs to be run in Windows PowerShell, not in PowerShell ISE.
Had the same situation and when run in PS - it finished without errors and created the app.
Best!