-
Notifications
You must be signed in to change notification settings - Fork 27
Enganga/get msidinactivesigninuser #1438
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
base: main
Are you sure you want to change the base?
Conversation
Learn Build status updates of commit d778da9: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
# User Last Sign In Activity is before Days ago | ||
[Parameter(Mandatory = $true, ValueFromPipeline = $true, Position = 1)] | ||
[Alias("BeforeDaysAgo")] | ||
[int] $LastSignInBeforeDaysAgo = 30, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this paramater seems to be mandatory but has a default value of 30, should the [ValidateRange(30, [int]::MaxValue)] attribute be better used here?
$uri = "/beta/users?`$filter=$inactiveFilter&`$select=signInActivity,UserPrincipalName,Id,DisplayName,mail,userType,createdDateTime,accountEnabled" | ||
|
||
Write-Debug ("Retrieving Users with Filter {0}" -f $inactiveFilter) | ||
$queryUsers = (Invoke-GraphRequest -Method GET -Uri $uri -Headers $customHeaders).value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be filtered at the API level instead of client-side?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i.e
if ($UserType -ne "All") {
$inactiveFilter = "($inactiveFilter) and (userType eq '$UserType')"
}
Then just use the results directly
$users = (Invoke-GraphRequest -Method GET -Uri $uri -Headers $customHeaders).value
[OutputType([string])] | ||
param ( | ||
# User Last Sign In Activity is before Days ago | ||
[Parameter(Mandatory = $true, ValueFromPipeline = $true, Position = 1)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this paramater seems to be mandatory but has a default value of 30, should the [ValidateRange(30, [int]::MaxValue)] attribute be better to use here?
"Member" { $users = $queryUsers | Where-Object { $_.userType -eq 'Member' } } | ||
"Guest" { $users = $queryUsers | Where-Object { $_.userType -eq 'Guest' } } | ||
"All" { $users = $queryUsers } | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be filtered at the API level instead of client-side?
i.e
if ($UserType -ne "All") {
$inactiveFilter = "($inactiveFilter) and (userType eq '$UserType')"
}
Then just use the results directly
$users = (Invoke-GraphRequest -Method GET -Uri $uri -Headers $customHeaders).value
Porting of MSIdentityTools 'Get-MsIdInactiveSignInUser' to GA and Beta Entra PowerShell.