Power shell Script after user creation

Power shell Script after user creation

I am looking to run a custom PowerShell script after user creation to add a users to a O365 only group. I am having trouble figuring out if you need to run commands to connect to Exchange Online first or not. We use Modern authentication in our environment. Does anyone know if this is possible? Thank-you