I am currently working on a PowerShell Code I can deploy in Azure-Functions, that creates a new SharePoint Site. I am working in Visual Studio Code.
Everything is working fine when doing it in PowerShell manually, but some commands don't seem to work in the Code. New-PnPSite throws:
Exception: No connection, please connect first with Connect-PnPOnline
This Exception makes complete sense but when I use "Connect-PnPOnline" before using "New-PnPSite", I get:
ERROR: Connect-PnPOnline : Method not found: 'System.Runtime.Remoting.ObjectHandle System.Activator.CreateInstance(System.String, System.String)'.
I am not sure why it's not working, because my PowerShell and my Visual Studio Code PowerShell Code are using the same Module folder. How do I get it to work in Visual Studio Code?
Thanks in Advance!