Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
merill committed Jun 8, 2024
2 parents 5c661e0 + ff0d73a commit b2b360e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Find-MsIdUnprotectedUsersWithAdminRoles.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function Find-MsIdUnprotectedUsersWithAdminRoles {
begin {
## Initialize Critical Dependencies
$CriticalError = $null
if (!(Test-MgCommandPrerequisites 'Get-MgUser', 'Get-MgUserAuthenticationMethod', 'Get-MgGroupMember', 'Get-MgRoleManagementDirectoryRoleDefinition', 'Get-MgRoleManagementDirectoryRoleAssignmentSchedule', 'Get-MgRoleManagementDirectoryRoleEligibilitySchedule', 'Get-MgAuditLogSignIn' -ApiVersion beta -MinimumVersion 2.8.0 -RequireListPermissions -ErrorVariable CriticalError)) { return }
if (!(Test-MgCommandPrerequisites 'Get-MgUser', 'Get-MgUserAuthenticationMethod', 'Get-MgGroupMember', 'Get-MgRoleManagementDirectoryRoleDefinition', 'Get-MgRoleManagementDirectoryRoleAssignmentSchedule', 'Get-MgRoleManagementDirectoryRoleEligibilitySchedule', 'Get-MgAuditLogSignIn' -MinimumVersion 2.8.0 -RequireListPermissions -ErrorVariable CriticalError)) { return }


if ($VerbosePreference -eq 'SilentlyContinue') {
Expand Down
2 changes: 1 addition & 1 deletion src/Get-MsIdGroupWritebackConfiguration.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function Get-MsIdGroupWritebackConfiguration {
begin {
## Initialize Critical Dependencies
$CriticalError = $null
if (!(Test-MgCommandPrerequisites 'Get-MgGroup' -ApiVersion beta -MinimumVersion 2.8.0 -ErrorVariable CriticalError)) { return }
if (!(Test-MgCommandPrerequisites 'Get-MgGroup' -MinimumVersion 2.8.0 -ErrorVariable CriticalError)) { return }
}

process {
Expand Down
13 changes: 10 additions & 3 deletions src/Get-MsIdInactiveSignInUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,17 @@ function Get-MsIdInactiveSignInUser {
$checkedUser.LastSignInDateTime = $userObject.signInActivity.LastSignInDateTime
$checkedUser.LastSigninDaysAgo = (New-TimeSpan -Start $checkedUser.LastSignInDateTime -End (Get-Date)).Days
$checkedUser.lastSignInRequestId = $userObject.signInActivity.lastSignInRequestId
$checkedUser.lastNonInteractiveSignInDateTime = $userObject.signInActivity.lastNonInteractiveSignInDateTime

$checkedUser.LastNonInteractiveSigninDaysAgo = (New-TimeSpan -Start $checkedUser.lastNonInteractiveSignInDateTime -End (Get-Date)).Days
$checkedUser.lastNonInteractiveSignInRequestId = $userObject.signInActivity.lastNonInteractiveSignInRequestId
#lastNonInteractiveSignInDateTime is NULL
If ($null -eq $userObject.signInActivity.lastNonInteractiveSignInDateTime){
$checkedUser.lastNonInteractiveSignInDateTime = "Unknown"
$checkedUser.LastNonInteractiveSigninDaysAgo = "Unknown"

} else {
$checkedUser.lastNonInteractiveSignInDateTime = $userObject.signInActivity.lastNonInteractiveSignInDateTime
$checkedUser.LastNonInteractiveSigninDaysAgo = (New-TimeSpan -Start $checkedUser.lastNonInteractiveSignInDateTime -End (Get-Date)).Days
$checkedUser.lastNonInteractiveSignInRequestId = $userObject.signInActivity.lastNonInteractiveSignInRequestId
}
}
If ($null -eq $userObject.CreatedDateTime) {
$checkedUser.CreatedDateTime = "Unknown"
Expand Down
2 changes: 1 addition & 1 deletion src/Update-MsIdGroupWritebackConfiguration.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function Update-MsIdGroupWritebackConfiguration {
begin {
## Initialize Critical Dependencies
$CriticalError = $null
if (!(Test-MgCommandPrerequisites 'Get-MgGroup', 'Update-MgGroup' -ApiVersion beta -MinimumVersion 2.8.0 -ErrorVariable CriticalError)) { return }
if (!(Test-MgCommandPrerequisites 'Get-MgGroup', 'Update-MgGroup' -MinimumVersion 2.8.0 -ErrorVariable CriticalError)) { return }
}

process {
Expand Down
4 changes: 2 additions & 2 deletions src/internal/Test-MgCommandPrerequisites.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function Test-MgCommandPrerequisites {
[string[]] $Name,
# The service API version.
[Parameter(Mandatory = $false, Position = 2)]
[ValidateSet('v1.0', 'beta')]
[ValidateSet('v1.0')]
[string] $ApiVersion = 'v1.0',
# Specifies a minimum version.
[Parameter(Mandatory = $false)]
Expand Down Expand Up @@ -49,7 +49,7 @@ function Test-MgCommandPrerequisites {


if ($MgCommands.Count -gt 1) {
$MgCommand = $MgCommands[0]
$MgCommand = $MgCommands[0]
## Resolve from multiple results
[array] $MgCommandsWithPermissions = $MgCommands | Where-Object Permissions -NE $null
[array] $MgCommandsWithListPermissions = $MgCommandsWithPermissions | Where-Object URI -NotLike "*}"
Expand Down

0 comments on commit b2b360e

Please sign in to comment.