Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter to find unlicensed users does not work #2112

Closed
carlosdzrz opened this issue Jun 28, 2023 · 5 comments
Closed

Filter to find unlicensed users does not work #2112

carlosdzrz opened this issue Jun 28, 2023 · 5 comments

Comments

@carlosdzrz
Copy link

I run the Get-MgUser command with the following filter: Filter = 'assignedLicenses/$count eq 0 and OnPremisesSyncEnabled eq true'. It always returns the same two results, which do not correspond to reality. Currently in the tenant I have 17 unlicensed users. Here is an example:
image

@ghost ghost added the ToTriage label Jun 28, 2023
@peombwa
Copy link
Member

peombwa commented Jun 30, 2023

Thanks for following through on this.

Calling the command with -Debug will reveal that the inaccurate count is coming from the service. Please follow the troubleshooting guide and open a service question with the API owner at https://developer.microsoft.com/en-us/graph/support for this to be invested.

@ghost
Copy link

ghost commented Jul 4, 2023

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@carlosdzrz
Copy link
Author

I attach the transcript file with the debug parameter. I have deleted the personal information data of the tenant users.
I have opened a service question. thank you very much.
debug.log

@peombwa
Copy link
Member

peombwa commented Jul 5, 2023

Thanks for providing the debug log. The debug log shows that the wrong count is coming from the API via the @odata.count response. I'd recommend you open a service issue at https://developer.microsoft.com/en-us/graph/support to get further assistance from the API owner. Please include the requestId and date of the affected request in your ticket/question. See Microsoft Graph PowerShell module troubleshooting guide for more details.

Since you are using v2 of SDK, can you confirm if the inconsistent count is also present when using the dedicated count commands - Get-MgUserCount -Filter 'assignedLicenses/$count eq 0 and OnPremisesSyncEnabled eq true' -ConsistencyLevel eventual. This command calls GET https://graph.microsoft.com/v1.0/users/$count.

@ghost
Copy link

ghost commented Jul 9, 2023

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost ghost closed this as completed Jul 13, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants