Make a report #4246
-
Hi guys, I try to make a report to see which user with which user type, country, location have permissions on each site collection of my tenant. I tried to do something like this: #connection via app registration and certificate $sites = Get-PnPTenantSite Foreach ($site in $sites) { Connect-PnPOnline -Url $site -ClientId $clientId -Thumbprint $Thumbprint -Tenant "$tenantid $users = Get-PnPUser Foreach ($user in $users) { $guests += $azureADUser | Where-Object UserType -eq "Guest" } What I am doing, with the cmdlet Get-PnPAzureADUser I retrieve no values? Thanks for your help |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 10 replies
-
Hi @martinlingstuyl , Maybe you can help me in this question, because when I iterate through a lot spo sites the cmdlet Get-PnPAzureADUser didn't filter the user and I don't retrieve any information when I use to select or filter in combination with this cmdlet Get-PnPAzureADUser. Thank you very much 😊 |
Beta Was this translation helpful? Give feedback.
-
Hi @nicole-ge, I believe this is because the format of the LoginName is not usable in the The format of the LoginName coming from Get-PnPUser is # This works
Get-PnPEntraIDUser -Identity "[email protected]"
# This does not
Get-PnPEntraIDUser -Identity "i:0#.f|membership|[email protected]"
🚀 Have a great day! |
Beta Was this translation helpful? Give feedback.
-
It is not working. I got the following error: the provided value for scope user.read.all is not valid. Client credentials flows must have a scope value with /.default .... What can I do now? Kind regards |
Beta Was this translation helpful? Give feedback.
-
I think there is an issue with the cmdlet I will try the nightly update of pnp And send you my script |
Beta Was this translation helpful? Give feedback.
-
hi @martinlingstuyl , here is my script and don't know why it doesn't work. can you please help me: $Sites = Get-PnPTenantSite Write-Output $Sites.Count #Iterate through each site collection
} |
Beta Was this translation helpful? Give feedback.
Hi @nicole-ge, ah wait, forget CSOM, this is a Graph commandlet. You may check if using the -Select option gives you something: