Forum Discussion
Gurdev Singh
Oct 22, 2022Iron Contributor
Connect to SPO from Azure automation runbook using a certificate
How to connect to SPO using Pnp powershell Connect-PnpOnline using a certificate with script being executed from Azure automation runbook.
I have exported a self-signed certificate and uploaded to Azure Automation. When I use the following it does not work. Another thing I noticed is that Connect-PnPOnline requires a certificatePath paramater. What are my options here when certificate is stored in Azure automation.
This does not work:
Connect-PnPOnline -Thumbprint "3234234" -Url $url -ClientId $clientId -Tenant "tenant.onmicrosoft.com"
Alternative, with script being run from runbook what could I use for path
Connect-PnPOnline -CertificatePath "??????" -CertificatePassword "3234234" -Url $url -ClientId $clientId -Tenant "tenant.onmicrosoft.com"
- Gurdev SinghIron ContributorThanks Nanddeep...However, I have discovered with new version of PowerShell and PnP, the certificate thumbprint parameter no longer works and Connect-PnPOnline requires a certificatePath parameter instead.
- David RemillardCopper ContributorHi Gurdev,
I'm having the same issue. I can actually connect using a thumbprint when running from my laptop, but when running the same command and same app reg and thumbprint in an Azure runbook, the connect fails and says it can't find a cert. Where did you end up storing the .pfx file so that you could reference it in your runbook? Azure Storage? Do you have an example of your powershell commands for the connection?
Thanks,
Dave