Skip to content

Cut 5073 migrate jumpcloud power shell modules to use specific endpoints#724

Open
shashisinghjc wants to merge 16 commits into3.1.0_pwshModulefrom
CUT-5073-Migrate-Jumpcloud-PowerShellModules-To-Use-Specific-Endpoints
Open

Cut 5073 migrate jumpcloud power shell modules to use specific endpoints#724
shashisinghjc wants to merge 16 commits into3.1.0_pwshModulefrom
CUT-5073-Migrate-Jumpcloud-PowerShellModules-To-Use-Specific-Endpoints

Conversation

@shashisinghjc
Copy link

@shashisinghjc shashisinghjc commented Mar 9, 2026

Issues

CUT-5073 - Migrate JumpCloud Powershell modules to use type-specific endpoints

What does this solve?

It ensures the module supports the new Shared Groups feature and aligns with backend API changes, while maintaining backward compatibility and encouraging users to upgrade to newer module versions.

Is there anything particularly tricky?

NA

How should this be tested?

Verify that the PowerShell module uses the new type-specific group cmdlets instead of the generic Get-JCGroup. Test by retrieving groups using Get-JCSystemGroup, Get-JCUserGroup, and Get-JCPolicyGroup to confirm they return expected results without errors. Validate getting groups by ID and filters, creating a new group, and removing a group. Ensure functionality works correctly and no calls are made to the deprecated /api/v2/groups endpoint.

Screenshots


Note

Medium Risk
Moderate risk because group and policy-group retrieval/membership now routes to new type-specific v2 endpoints and replaces legacy policy-group implementations, which could impact scripts relying on previous parameters/response shapes.

Overview
Updates the PowerShell module to support type-specific group APIs by adding new SDK-backed cmdlets for System, User, and Policy groups (including policy-group CRUD and membership management) and exporting them in JumpCloud.psd1 (bumping version to 3.1.0).

Enhances Get-JCGroup and Get-DynamicHash to handle Policy groups and to query the dedicated endpoints (/api/v2/usergroups, /api/v2/systemgroups, /api/v2/policygroups) with stricter case-sensitive name lookups, while removing the older custom Policies/PolicyGroups implementations.

Refreshes DirectoryInsights help text/links and adds/updates Pester coverage for the new group and policy-group cmdlets, plus minor test parameter cleanups and changelog updates.

Written by Cursor Bugbot for commit fd197c3. This will update automatically on new commits. Configure here.

@shashisinghjc shashisinghjc added minor minor version release PowerShell Module Release for JumpCloud PowerShell Module labels Mar 9, 2026
…et-JcSdkPolicyGroup, New-JcSdkPolicyGroup, Remove-JcSdkPolicyGroup, Get-JcSdkPolicyGroupMember, Set-JcSdkPolicyGroupMember
@shashisinghjc shashisinghjc marked this pull request as ready for review March 11, 2026 08:50
@shashisinghjc shashisinghjc requested a review from a team as a code owner March 11, 2026 08:50
[Sort <String>]: ASC or DESC order for timestamp
.Link
https://github.com/TheJumpCloud/jcapi-powershell/tree/master/SDKs/PowerShell/JumpCloud.SDK.DirectoryInsights/docs/exports/Get-JcSdkEvent.md
https://github.com/TheJumpCloud/jcapi-powershell/tree/CUT-4981_v2EUSupport/SDKs/PowerShell/JumpCloud.SDK.DirectoryInsights/docs/exports/Get-JcSdkEvent.md
Copy link

Choose a reason for hiding this comment

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

Documentation links point to feature branch not master

Low Severity

The .Link URLs in Get-JCEvent.ps1 and Get-JCEventCount.ps1 were changed from pointing to master branch to CUT-4981_v2EUSupport, a feature branch. This appears to be an accidental commit from SDK generation and will produce broken documentation links once the feature branch is deleted.

Additional Locations (1)
Fix in Cursor Fix in Web

Copy link
Contributor

@jworkmanjc jworkmanjc left a comment

Choose a reason for hiding this comment

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

Okay Hey @shashisinghjc I've not done a good job writing this card.

You've solved the first aspect of this card, gone above and solved the second aspect but we already have a set of Get/Set/Remove-JCPolicyGroup cmdlets in our module which is my mistake adding them.

What I want us to do is this. You've done what was asked in the card. Let's merge 80% of this into a new release branch for 3.1.0. I'm looking at the difference between the Auto-Generated SDK functions in the PWSH Module and what I wrote for policy groups. There's a few things I think we can take from both.

My aim with the PWSH module was to provide admins with the easiest way of interacting with our API possible. SDKs are autogenerated and do not include quality of life things like searching by name. I'll create another card for this, but I'd like to add a new parameter to our auto-generated functions for searching by Name, then we can bring in these new functions you've added to the module.

Today we've got the function Get-JCPolicyGroup which has parameters for ID and Name. You can specify something like Get-JCPolicyGroup -id 671a7433adf66800018e38da or Get-JCPolicyGroup -name "Windows Update"
Image to get the same result.

The autogenerated SDK function brought in has the SDK parameters for filter/ fields/ sort. Which are missing from my handwritten function. My aim would be to bridge these in another card.

Let's do this.

  • Remove the Auto-Generated Policy functions, these exist in Public/Policies/PolicyGroups
  • Retain the new functions Get-JCSystemGroup.ps1, Get-JCUserGroup.ps1
  • Retain changes to Get-JCGroup.ps1
  • I'll create a new card to modify the jcapiToSupportSync.ps1 function to:
    • automatically add a new "Name" parameter to generated functions
    • Generate new functions for:
      • Get/Set/Remove-JCSystemGroup
      • Get/Set/Remove-JCUserGroup
      • Get/Set/Remove-JCPolicyGroup

If we auto generate those functions, we'll get the latest changes from our SDKs, but still retain the ability to search for groups by "Name" which is the case for the current Get-JCPolicyGroup function. IMO we can merge this into a release branch without getting all tests to pass, you've done 99% of the work here given my poor planning I don't need to hold it up since we can't go live with it yet.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 4 potential issues.

}
AfterAll {
if ($TestGroup -and $TestGroup.id) {
Remove-JCPolicyGroup -PolicyGroupID $TestGroup.id -Force
Copy link

Choose a reason for hiding this comment

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

Tests use nonexistent -PolicyGroupID parameter on new cmdlets

High Severity

The new SDK-based Remove-JCPolicyGroup only accepts -Id, -InputObject, and -PassThru, but tests pass -PolicyGroupID and -Force (which don't exist). Similarly, Get-JCPolicyGroup only accepts -Id, not -PolicyGroupID. Since these cmdlets use [CmdletBinding()], PowerShell will throw a parameter-binding error at runtime. This affects AfterAll cleanup blocks, meaning test resources will be orphaned, and multiple test cases will fail.

Additional Locations (2)
Fix in Cursor Fix in Web

$group.name | Should -Be $TestGroupName
}
It 'Get by name returns expected result' {
$filtered = Get-JCPolicyGroup -Name $TestGroupName
Copy link

Choose a reason for hiding this comment

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

Tests use nonexistent -Name parameter on Get-JCPolicyGroup

High Severity

The new SDK-based Get-JCPolicyGroup accepts -Id, -InputObject, -Fields, -Filter, and -Sort — but not -Name. Tests call Get-JCPolicyGroup -Name $TestGroupName which will throw a parameter-binding error. Lookup by name now requires -Filter "name:eq:$TestGroupName" instead.

Additional Locations (1)
Fix in Cursor Fix in Web

'Remove-JCSystemGroupMember', 'Remove-JCSystemUser', 'Remove-JCUser',
'Remove-JCUserGroup', 'Remove-JCUserGroupMember',
'Send-JCPasswordReset', 'Set-JCCloudDirectory', 'Set-JCCommand',
'Set-JCOrganization', 'Set-JCPolicy', 'Set-JCPolicyGroup',
Copy link

Choose a reason for hiding this comment

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

Set-JCPolicyGroup exported but implementation file deleted

Medium Severity

Set-JCPolicyGroup is still listed in FunctionsToExport at line 105, but its implementation file (Public/Policies/PolicyGroups/Set-JCPolicyGroup.ps1) was deleted in this PR and no replacement was added. Users calling Set-JCPolicyGroup will get a "command not found" error. It needs to be removed from the exports list.

Fix in Cursor Fix in Web

@jworkmanjc jworkmanjc changed the base branch from master to 3.1.0_pwshModule March 12, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor minor version release PowerShell Module Release for JumpCloud PowerShell Module

Development

Successfully merging this pull request may close these issues.

2 participants