@@ -9,6 +9,7 @@ function Invoke-HuduExtensionSync {
99 )
1010 try {
1111 Connect-HuduAPI - configuration $Configuration
12+ $Configuration = $Configuration.Hudu
1213
1314 $CompanyResult = [PSCustomObject ]@ {
1415 Name = $Tenant.displayName
@@ -78,7 +79,7 @@ function Invoke-HuduExtensionSync {
7879 Write-Host " Hudu People - Error: $_ "
7980 }
8081
81- Write-Host " CreateUsers : $CreateUsers "
82+ Write-Host " Configuration : $ ( $Configuration | ConvertTo-Json ) "
8283
8384
8485 try {
@@ -104,8 +105,6 @@ function Invoke-HuduExtensionSync {
104105 Write-Host " Hudu Devices - Error: $_ "
105106 }
106107
107- Write-Host " CreateDevices: $CreateDevices "
108-
109108 $importDomains = $Configuration.ImportDomains
110109 $monitordomains = $Configuration.MonitorDomains
111110
@@ -161,9 +160,7 @@ function Invoke-HuduExtensionSync {
161160
162161 $Users = $ExtensionCache.Users
163162 $licensedUsers = $Users | Where-Object { $null -ne $_.assignedLicenses.skuId } | Sort-Object userPrincipalName
164-
165163 $CompanyResult.users = ($licensedUsers | Measure-Object ).count
166-
167164 $AllRoles = $ExtensionCache.AllRoles
168165
169166
@@ -264,32 +261,6 @@ function Invoke-HuduExtensionSync {
264261 }
265262 }
266263
267- # $DeviceApps = $ExtensionCache.DeviceApps
268- <# $DeviceApps = Get-BulkResultByID -Results $TenantResults -ID 'DeviceApps'
269-
270- [System.Collections.Generic.List[PSCustomObject]]$RequestArray = @()
271- foreach ($InstalledApp in $DeviceApps | Where-Object { $_.isAssigned -eq $True }) {
272- $RequestArray.add(@{
273- id = $InstalledApp.id
274- method = 'GET'
275- url = "/deviceAppManagement/mobileApps/$($InstalledApp.id)/deviceStatuses"
276- })
277- }
278- try {
279- $InstalledAppDetailsReturn = New-GraphBulkRequest -Headers $AuthHeaders -Requests $RequestArray -tenantid $TenantFilter
280- } catch {
281- $CompanyResult.Errors.add("Company: Unable to fetch Installed Device Details $_")
282- $InstalledAppDetailsReturn = $null
283- }#>
284- <#
285- $DeviceAppInstallDetails = foreach ($DeviceApp in $DeviceApps) {
286- [pscustomobject]@{
287- ID = $DeviceApp.id
288- DisplayName = $DeviceApp.displayName
289- #InstalledAppDetails = $DeviceAppStatus
290- }
291- }#>
292-
293264 $AllGroups = $ExtensionCache.Groups
294265
295266 $Groups = foreach ($Group in $AllGroups ) {
@@ -635,14 +606,14 @@ function Invoke-HuduExtensionSync {
635606
636607 [System.Collections.Generic.List [PSCustomObject ]]$CIPPLinksFormatted = @ ()
637608 if ($EnableCIPP ) {
638- $CIPPLinksFormatted.add ((Get-HuduLinkBlock - URL " $ ( $CIPPURL ) /identity/administration/users/view?customerId =$ ( $Tenant.customerid ) &userId=$ ( $User.id ) &tenantDomain= $ ( $Tenant .defaultDomainName ) &userEmail= $ ( $User .userPrincipalName ) " - Icon ' far fa-eye' - Title ' CIPP - View User' ))
639- $CIPPLinksFormatted.add ((Get-HuduLinkBlock - URL " $ ( $CIPPURL ) /identity/administration/users/edit?customerId =$ ( $Tenant.customerid ) &userId=$ ( $User.id ) &tenantDomain= $ ( $Tenant .defaultDomainName ) &userEmail= $ ( $User .userPrincipalName ) " - Icon ' fas fa-user-cog' - Title ' CIPP - Edit User' ))
640- $CIPPLinksFormatted.add ((Get-HuduLinkBlock - URL " $ ( $CIPPURL ) /identity/administration/ViewBec?customerId =$ ( $Tenant.customerid ) &userId=$ ( $User.id ) &tenantDomain= $ ( $Tenant .defaultDomainName ) &ID= $ ( $User .userPrincipalName ) " - Icon ' fas fa-user-secret' - Title ' CIPP - BEC Tool' ))
609+ $CIPPLinksFormatted.add ((Get-HuduLinkBlock - URL " $ ( $CIPPURL ) /identity/administration/users/user?tenantFilter =$ ( $Tenant.defaultDomainName ) &userId=$ ( $User.id ) " - Icon ' far fa-eye' - Title ' CIPP - View User' ))
610+ $CIPPLinksFormatted.add ((Get-HuduLinkBlock - URL " $ ( $CIPPURL ) /identity/administration/users/user/ edit?tenantFilter =$ ( $Tenant.defaultDomainName ) &userId=$ ( $User.id ) " - Icon ' fas fa-user-cog' - Title ' CIPP - Edit User' ))
611+ $CIPPLinksFormatted.add ((Get-HuduLinkBlock - URL " $ ( $CIPPURL ) /identity/administration/users/user/bec?tenantFilter =$ ( $Tenant.defaultDomainName ) &userId=$ ( $User.id ) )" - Icon ' fas fa-user-secret' - Title ' CIPP - BEC Tool' ))
641612 }
642613
643614 [System.Collections.Generic.List [PSCustomObject ]]$UserLinksFormatted = @ ()
644- $UserLinksFormatted.add ((Get-HuduLinkBlock - URL " https://aad.portal.azure .com/$ ( $Tenant.defaultDomainName ) /#blade/Microsoft_AAD_IAM/UserDetailsMenuBlade/Profile/userId/$ ( $User.id ) " - Icon ' fas fa-users-cog' - Title ' Entra ID' ))
645- $UserLinksFormatted.add ((Get-HuduLinkBlock - URL " https://aad.portal.azure .com/$ ( $Tenant.defaultDomainName ) /#blade/Microsoft_AAD_IAM/UserDetailsMenuBlade/SignIns/userId/$ ( $User.id ) " - Icon ' fas fa-history' - Title ' Sign Ins' ))
615+ $UserLinksFormatted.add ((Get-HuduLinkBlock - URL " https://entra.microsoft .com/$ ( $Tenant.defaultDomainName ) /#blade/Microsoft_AAD_IAM/UserDetailsMenuBlade/Profile/userId/$ ( $User.id ) " - Icon ' fas fa-users-cog' - Title ' Entra ID' ))
616+ $UserLinksFormatted.add ((Get-HuduLinkBlock - URL " https://entra.microsoft .com/$ ( $Tenant.defaultDomainName ) /#blade/Microsoft_AAD_IAM/UserDetailsMenuBlade/SignIns/userId/$ ( $User.id ) " - Icon ' fas fa-history' - Title ' Sign Ins' ))
646617 $UserLinksFormatted.add ((Get-HuduLinkBlock - URL " https://admin.teams.microsoft.com/users/$ ( $User.id ) /account?delegatedOrg=$ ( $Tenant.defaultDomainName ) " - Icon ' fas fa-users' - Title ' Teams Admin' ))
647618 $UserLinksFormatted.add ((Get-HuduLinkBlock - URL " https://intune.microsoft.com/$ ( $Tenant.defaultDomainName ) /#blade/Microsoft_AAD_IAM/UserDetailsMenuBlade/Profile/userId/$ ( $User.ID ) " - Icon ' fas fa-laptop' - Title ' Intune (User)' ))
648619 $UserLinksFormatted.add ((Get-HuduLinkBlock - URL " https://intune.microsoft.com/$ ( $Tenant.defaultDomainName ) /#blade/Microsoft_AAD_IAM/UserDetailsMenuBlade/Devices/userId/$ ( $User.ID ) " - Icon ' fas fa-laptop' - Title ' Intune (Devices)' ))
@@ -664,8 +635,8 @@ function Invoke-HuduExtensionSync {
664635 email_address = $user.userPrincipalName
665636 }
666637 $NewHash = Get-StringHash - String $UserBody
667-
668638 $HuduUserCount = ($HuduUser | Measure-Object ).Count
639+
669640 if ($HuduUserCount -eq 1 ) {
670641 $ExistingAsset = Get-CIPPAzDataTableEntity @HuduAssetCache - Filter " PartitionKey eq 'HuduUser' and CompanyId eq '$company_id ' and RowKey eq '$ ( $HuduUser.id ) '"
671642 $ExistingHash = $ExistingAsset.Hash
@@ -683,7 +654,7 @@ function Invoke-HuduExtensionSync {
683654 }
684655
685656 } elseif ($HuduUserCount -eq 0 ) {
686- if ($CreateUsers -eq $True ) {
657+ if ($CreateUsers -eq $true ) {
687658 $CompanyResult.Logs.Add (" Creating $ ( $User.displayName ) in Hudu" )
688659 $CreateHuduUser = (New-HuduAsset - Name $User.displayName - company_id $company_id - asset_layout_id $PeopleLayout.id - Fields $UserAssetFields ).asset
689660 if (! $CreateHuduUser ) {
0 commit comments