add: 1.1.1 test as automated and organized csv.
This commit is contained in:
@@ -4,10 +4,10 @@ Import-Module .\output\module\M365FoundationsCISReport\*\*.psd1
|
||||
|
||||
|
||||
<#
|
||||
$ver = "v0.0.1"
|
||||
$ver = "v0.1.1"
|
||||
git checkout main
|
||||
git pull origin main
|
||||
git tag -a $ver -m "Release version $ver Minor Update"
|
||||
git tag -a $ver -m "Release version $ver Bugfix Update"
|
||||
git push origin $ver
|
||||
"Fix: PR #37"
|
||||
git push origin $ver
|
||||
|
45
helpers/Get-AdminRoleUserLicense.ps1
Normal file
45
helpers/Get-AdminRoleUserLicense.ps1
Normal file
@@ -0,0 +1,45 @@
|
||||
function Get-AdminRoleUserLicense {
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
[Parameter(Mandatory = $false)]
|
||||
[bool]$SkipGraphConnection = $false
|
||||
)
|
||||
|
||||
# Connect to Microsoft Graph if not skipping connection
|
||||
if (-not $SkipGraphConnection) {
|
||||
Connect-MgGraph -Scopes "Directory.Read.All", "Domain.Read.All", "Policy.Read.All", "Organization.Read.All" -NoWelcome
|
||||
}
|
||||
|
||||
$adminRoleUsers = @()
|
||||
$userIds = @()
|
||||
$adminroles = Get-MgRoleManagementDirectoryRoleDefinition | Where-Object { $_.DisplayName -like "*Admin*" }
|
||||
|
||||
foreach ($role in $adminroles) {
|
||||
$usersInRole = Get-MgRoleManagementDirectoryRoleAssignment -Filter "roleDefinitionId eq '$($role.Id)'"
|
||||
|
||||
foreach ($user in $usersInRole) {
|
||||
$userIds += $user.PrincipalId
|
||||
$userDetails = Get-MgUser -UserId $user.PrincipalId -Property "DisplayName, UserPrincipalName, Id, onPremisesSyncEnabled"
|
||||
|
||||
$adminRoleUsers += [PSCustomObject]@{
|
||||
RoleName = $role.DisplayName
|
||||
UserName = $userDetails.DisplayName
|
||||
UserPrincipalName = $userDetails.UserPrincipalName
|
||||
UserId = $userDetails.Id
|
||||
HybridUser = $userDetails.onPremisesSyncEnabled
|
||||
Licenses = "" # Placeholder for licenses, to be filled later
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($userId in $userIds | Select-Object -Unique) {
|
||||
$licenses = Get-MgUserLicenseDetail -UserId $userId
|
||||
$licenseList = ($licenses.SkuPartNumber -join '|')
|
||||
|
||||
$adminRoleUsers | Where-Object { $_.UserId -eq $userId } | ForEach-Object {
|
||||
$_.Licenses = $licenseList
|
||||
}
|
||||
}
|
||||
|
||||
return $adminRoleUsers
|
||||
}
|
Reference in New Issue
Block a user