Skip to content

V2.9.4#214

Merged
kmaranionjc merged 10 commits into
masterfrom
v2.9.4
Oct 28, 2025
Merged

V2.9.4#214
kmaranionjc merged 10 commits into
masterfrom
v2.9.4

Conversation

jworkmanjc and others added 3 commits October 28, 2025 08:16
* invoke changes for duplicate SIDs

* invoke script cleanup

* validate changes for local device

* invoke migration CSV validation tests

* pwsh 5.1 returning non list
* invoke changes for duplicate SIDs

* invoke script cleanup

* validate changes for local device

* invoke migration CSV validation tests

* removeMDM

* RemoveMDM

* generate docs from windows & update tests for 5.1

* uncheck removeMDM if leave domain in de-selected
* init test EU

* run number

* systemContext

* ci

* test

* ci env

* test EU

* api test

* test

* api test

* pester vars

* invoke systemcontext url

* revert ci

* URL

* Update Deploy/Functions/New-ADMUTemplate.ps1

[skip ci]

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update jumpcloud-ADMU/Powershell/Private/DisplayForms/Form.ps1

[skip ci]

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update jumpcloud-ADMU/Powershell/Private/SystemContext/Invoke-SystemContextAPI.ps1

[skip ci]

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* dates

* Update .github/workflows/admu-ci.yml

[skip ci]

Co-authored-by: Joe Workman <54448601+jworkmanjc@users.noreply.github.com>

* invoke system context + move set-jcurl test

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Joe Workman <54448601+jworkmanjc@users.noreply.github.com>
@kmaranionjc
kmaranionjc requested a review from a team as a code owner October 28, 2025 20:37
@kmaranionjc
kmaranionjc requested a review from gweinjc October 28, 2025 20:37
@kmaranionjc kmaranionjc added ADMU ADMU Module Release patch Patch version release labels Oct 28, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the ADMU (Active Directory Migration Utility) to version 2.9.4, introducing support for JumpCloud EU organizations and adding MDM removal capabilities during device migration.

Key Changes:

  • Added EU region support for JumpCloud API authentication
  • Implemented MDM enrollment removal feature with the removeMDM parameter
  • Refined CSV validation logic to check for duplicate SIDs only on the local device

Reviewed Changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
JumpCloud.ADMU.psd1 Updated module version from 2.9.3 to 2.9.4
Start-Migration.ps1 Added removeMDM parameter and MDM removal logic
Get-WindowsMDMProvider.ps1 New function to retrieve Windows MDM enrollment information
Remove-WindowsMDMProvider.ps1 New function to remove Windows MDM enrollments
Invoke-SystemContextAPI.ps1 Added region detection from agent config and dynamic URL construction
Set-JCUrl.ps1 New function to set JumpCloud URL based on region (US/EU)
Test-JumpCloudUsername.ps1 Updated to support US/EU region fallback logic
Get-MtpOrganization.ps1 Added try/catch blocks for US/EU region failover
Form.ps1 Added RemoveMDM checkbox to GUI and version update
invokeMigration.Tests.ps1 Refined duplicate SID validation to only check local device
3_ADMU_Invoke.ps1 Updated CSV validation and integrated MDM removal into batch migration
Comments suppressed due to low confidence (1)

jumpcloud-ADMU/Powershell/Tests/Public/invokeMigration.Tests.ps1:1

  • The code structure has mismatched or extra closing braces. Line 188 closes the PSCustomObject Add, line 189 closes the if statement checking LocalComputerName/SerialNumber, but line 190 appears to be an extra closing brace that doesn't match the opening structure shown in the diff.
Describe "ADMU Bulk Migration Script CI Tests" -Tag "Migration Parameters" {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread jumpcloud-ADMU/Powershell/Private/WindowsMDM/Remove-WindowsMDMProvider.ps1 Outdated
Comment thread jumpcloud-ADMU/Powershell/Private/SystemContext/Invoke-SystemContextAPI.ps1 Outdated
Comment on lines +46 to +51
# Call EU endpoint if US fails
Set-JcUrl -Region "EU"
$baseUrl = "$($global:JCUrl)/api/search/systemusers"
$Response = Invoke-WebRequest -Method 'Post' -Uri $baseUrl -Headers $Headers -Body $Body -UseBasicParsing
$Results = $Response.Content | ConvertFrom-Json
$StatusCode = $Response.StatusCode

Copilot AI Oct 28, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The catch block silently retries with the EU endpoint without logging the original US endpoint failure. If the EU endpoint also fails, the error will be misleading. Add logging before the EU retry and proper error handling if both endpoints fail.

Suggested change
# Call EU endpoint if US fails
Set-JcUrl -Region "EU"
$baseUrl = "$($global:JCUrl)/api/search/systemusers"
$Response = Invoke-WebRequest -Method 'Post' -Uri $baseUrl -Headers $Headers -Body $Body -UseBasicParsing
$Results = $Response.Content | ConvertFrom-Json
$StatusCode = $Response.StatusCode
$usError = $_
Write-ToLog -Message "US endpoint failed: $($usError.Exception.Message)" -Level Error -Step "Test-JumpCloudUsername"
# Call EU endpoint if US fails
try {
Set-JcUrl -Region "EU"
$baseUrl = "$($global:JCUrl)/api/search/systemusers"
$Response = Invoke-WebRequest -Method 'Post' -Uri $baseUrl -Headers $Headers -Body $Body -UseBasicParsing
$Results = $Response.Content | ConvertFrom-Json
$StatusCode = $Response.StatusCode
} catch {
$euError = $_
Write-ToLog -Message "EU endpoint also failed: $($euError.Exception.Message)" -Level Error -Step "Test-JumpCloudUsername"
$Results = $null
$StatusCode = $null
}

Copilot uses AI. Check for mistakes.
Comment on lines +34 to +37
# Call EU endpoint if US fails
Set-JcUrl -Region "EU"
$baseUrl = "$($global:JCUrl)/api/organizations/$($orgID)"
$Request = Invoke-WebRequest -Uri "$($baseUrl)?limit=$($limit)&skip=$($skip)" -Method Get -Headers $Headers -UseBasicParsing

Copilot AI Oct 28, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The catch block silently retries with the EU endpoint without logging the failure or re-throwing if the EU endpoint also fails. This pattern appears twice in this function and should include proper error handling for both failures.

Copilot uses AI. Check for mistakes.
Comment on lines +150 to +152
Set-JcUrl -Region "EU"
$baseUrl = "$($global:JCUrl)/api/organizations"
$Request = Invoke-WebRequest -Uri "$($baseUrl)?limit=$($limit)&skip=$($skip)" -Method Get -Headers $Headers -UseBasicParsing

Copilot AI Oct 28, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to other try/catch blocks in this PR, the EU endpoint retry lacks error logging and handling if the retry also fails. The user will not receive clear feedback about which region failed or why.

Suggested change
Set-JcUrl -Region "EU"
$baseUrl = "$($global:JCUrl)/api/organizations"
$Request = Invoke-WebRequest -Uri "$($baseUrl)?limit=$($limit)&skip=$($skip)" -Method Get -Headers $Headers -UseBasicParsing
try {
Set-JcUrl -Region "EU"
$baseUrl = "$($global:JCUrl)/api/organizations"
$Request = Invoke-WebRequest -Uri "$($baseUrl)?limit=$($limit)&skip=$($skip)" -Method Get -Headers $Headers -UseBasicParsing
} catch {
Write-Verbose "API key validation failed for EU region: $($_.Exception.Message)"
throw "API key validation failed for both US and EU regions: $($_.Exception.Message)"
}

Copilot uses AI. Check for mistakes.
Comment thread jumpcloud-ADMU-Advanced-Deployment/InvokeFromJCAgent/3_ADMU_Invoke.ps1 Outdated
Comment thread jumpcloud-ADMU-Advanced-Deployment/InvokeFromJCAgent/3_ADMU_Invoke.ps1 Outdated
Comment thread jumpcloud-ADMU-Advanced-Deployment/InvokeFromJCAgent/3_ADMU_Invoke.ps1 Outdated
Comment thread jumpcloud-ADMU/Powershell/Private/Authentication/Test-APIKey.ps1 Outdated
Comment thread jumpcloud-ADMU/Powershell/Private/DisplayForms/Form.ps1 Outdated
kmaranionjc and others added 6 commits October 28, 2025 14:35
[skip ci]

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…voke.ps1

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…Provider.ps1

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ontextAPI.ps1


Okay taking this suggestion and applying it

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@kmaranionjc
kmaranionjc merged commit 0c23dad into master Oct 28, 2025
11 checks passed
@kmaranionjc
kmaranionjc temporarily deployed to PublishToPSGallery October 28, 2025 22:21 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ADMU ADMU Module Release patch Patch version release

Development

Successfully merging this pull request may close these issues.

4 participants