I am trying to build a PowerShell script we can use to run hourly that would basically look for users who have recently signed up for Multifactor Authenticator or have Authenticator setup on their account in general and then add them to the group that controls conditional access if they aren't in there already.
I was trying to use the Get-MgUserAuthenticationMethod -UserId 'UPN' | fl command, and when I run it, it doesn't return anything.
We have an enterprise app setup and configured with the following permissions, user.read, user.read.all, and userauthenticationmethod.readwrite.all. In order to connect to graph using the enterprise app, we have a certificate that we use to authenticate.
Does anyone have any ideas on what may be going on or have any suggestions on what I could do instead to accomplish what I mentioned above? I don't have a ton of PowerShell experience, so any suggestions or input is appreciated.