I'm currently writing an "After User Creation" rule and I have a PowerShell script that adds the newly created, on-premises synced user to a handful of cloud-only Entra ID groups used for group based licensing. The problem I'm having is that the script keeps saying the user isn't found when I run the command using sAMAccountName or SID but it works fine if I go and find the Entra ID specific SID number for the user. The problem is that the Entra specific SID doesn't appear to be an option in the value references for my script.
So, how can I add an on-premises synced user to a cloud only group in an "After User Creation" rule using PowerShell?
I should note that using the regular actions (outside of PowerShell) work fine in this scenario, it is only the powershell cmdlet that fails. I need to use PowerShell for the additional condtional flexibility.