Grégory LASSERRE
GrĂ©gory LASSERRE•2d ago

Powershell script with PNP.Powershell module - How to connect with PFX SSL Certificate ?

Hello. I try to run a powershell script that use PNP.Powershell module. As reference here https://pnp.github.io/powershell/cmdlets/Connect-PnPOnline.html#example-5, the Connect-PNPOnline need to point to a PFX file. I'm newbie on windmill to be honest, i don't understand how / where i can store my pfx file in order to use it in my script. If someone can help me how to proceed please ? Best regards.
Connect-PnPOnline | PnP PowerShell
PnP PowerShell is an open source, community driven, PowerShell Module designed to work with Microsoft 365.
4 Replies
Hugo
Hugo•2d ago
you can either - load the content from a resource/variable/secret and write it as a pfx file in the current job directory before passing the path to Connect-PNPOnline - add a shared volume to your workers and put the pfx file there
Grégory LASSERRE
GrĂ©gory LASSERREOP•2d ago
Hello Hugo, thanks for replying i see shared volume solution, but i read is not persistent apparently how can i upload my file inside the shared volume ? i see ressource in documentation, but don't understand how to use it for my case, if you have a dummy example to point me, i will be happy đŸ™‚
Hugo
Hugo•2d ago
- for shared volume option, you just need to update docker compose to make it persistent and then put the file in there, you have a bunch of options but chatgpt should be able to guide you - for resource/variable option, i suggest you create a variable in the UI (/variables) then load it in your script using Get-WindmillVariable -Path 'u/user/foo'. Still in the same script you can write it to a file using powershell and then just pass the local file path to Connect-PnPOnline. You will need to encode the pfx binary content to base64/pem before storing it into the variable.
Grégory LASSERRE
GrĂ©gory LASSERREOP•2d ago
will try that this week, many thanks Hugo

Did you find this page helpful?