In my SharePoint Online site I've created a document library that contains a lot of folders.
I created these folders via PowerShell using PnP. I'm trying to set permissions on these folders, in particular I would like to set "Read-only" permission to a specific external user for each folder.
For example I've a folder called "AGENT00001" and I would like to share this folder with "email@example.com", then folder "AGENT00002" with "firstname.lastname@example.org" etc.
I've achieved my goal browsing my team site and the document library. I've selected the folder and using sharing functions in Modern UI I'm able to send an invitation to the external user, and he can access directly to the specific folder (he receives an e-mail with a direct link and then SharePoint asks for a verification code).
Is it possible to do the same thing (so sending the e-mail to a specific external user) with a PnP command or with other methods in a PowerShell script?