Skip to content

Commit a526529

Browse files
authored
Merge pull request #499 from TheJumpCloud/SA-3334_MTPImportUpdate
Sa 3334 mtp import update
2 parents fc97cb1 + ab18764 commit a526529

22 files changed

+1655
-29
lines changed

.circleci/workflows.yml

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ parameters:
4949
PublishToPSGallery:
5050
description: "When `true` and when run against Master branch, this workflow will publish the latest code to PSGallery"
5151
type: boolean
52-
default: false
52+
default: true
5353
ManualModuleVersion:
5454
description: "When `true` the pipeline will use the Module Version specified in JumpCloud Module JumpCloud.psd1 file"
5555
type: boolean
56-
default: false
56+
default: true
5757
orbs:
5858
win: circleci/windows@2.4.1
5959
executors:
@@ -135,6 +135,13 @@ workflows:
135135
- Build Nuspec
136136
- Invoke Git Commit
137137
context: aws-credentials
138+
- Pester Tests Linux MSP:
139+
requires:
140+
- Initial Setup
141+
- Build Help and Test Files
142+
- Build Nuspec
143+
- Invoke Git Commit
144+
context: aws-credentials
138145
- Publish Module Validation:
139146
requires:
140147
- Initial Setup
@@ -231,7 +238,7 @@ jobs:
231238
- invoke-pester:
232239
JumpCloudApiKey: $env:XAPIKEY_PESTER
233240
JumpCloudApiKeyMsp: $env:XAPIKEY_PESTER_MTP
234-
ExcludeTagList: "ModuleValidation, JCDeployment"
241+
ExcludeTagList: "ModuleValidation, JCDeployment, MSP"
235242
IncludeTagList: "*"
236243
RequiredModulesRepo: << pipeline.parameters.RequiredModulesRepo >>
237244
Shell: "pwsh.exe"
@@ -242,7 +249,7 @@ jobs:
242249
- invoke-pester:
243250
JumpCloudApiKey: $env:XAPIKEY_PESTER_MAC
244251
JumpCloudApiKeyMsp: $env:XAPIKEY_PESTER_MTP
245-
ExcludeTagList: "ModuleValidation, JCDeployment"
252+
ExcludeTagList: "ModuleValidation, JCDeployment, MSP"
246253
IncludeTagList: "*"
247254
RequiredModulesRepo: << pipeline.parameters.RequiredModulesRepo >>
248255
Shell: "pwsh"
@@ -254,10 +261,23 @@ jobs:
254261
- invoke-pester:
255262
JumpCloudApiKey: $env:XAPIKEY_PESTER_LINUX
256263
JumpCloudApiKeyMsp: $env:XAPIKEY_PESTER_MTP
257-
ExcludeTagList: "ModuleValidation, JCDeployment"
264+
ExcludeTagList: "ModuleValidation, JCDeployment, MSP"
258265
IncludeTagList: "*"
259266
RequiredModulesRepo: << pipeline.parameters.RequiredModulesRepo >>
260267
Shell: "pwsh"
268+
Pester Tests Linux MSP:
269+
machine:
270+
image: ubuntu-2004:202201-02
271+
steps:
272+
- setup-pester-env-linux
273+
- invoke-pester:
274+
JumpCloudApiKey: $env:XAPIKEY_PESTER_MTP
275+
JumpCloudApiKeyMsp: $env:XAPIKEY_PESTER_MTP
276+
JumpCloudMspOrg: $env:XORGID_PesterMSP
277+
ExcludeTagList: "None"
278+
IncludeTagList: "MSP"
279+
RequiredModulesRepo: << pipeline.parameters.RequiredModulesRepo >>
280+
Shell: "pwsh"
261281
Publish Module Validation:
262282
machine:
263283
image: ubuntu-2004:202201-02
@@ -513,6 +533,9 @@ commands:
513533
JumpCloudApiKeyMsp:
514534
type: string
515535
default: $env:XAPIKEY_PESTER_MTP
536+
JumpCloudMspOrg:
537+
type: string
538+
default: $env:XORGID_PesterMSP
516539
ExcludeTagList:
517540
type: string
518541
default: "None"
@@ -539,7 +562,7 @@ commands:
539562
command: |
540563
$ErrorActionPreference = 'stop'
541564
./PowerShell\Deploy\SdkSync\jcapiToSupportSync.ps1 -RequiredModulesRepo << pipeline.parameters.RequiredModulesRepo >>
542-
. "./PowerShell/JumpCloud Module/Tests/InvokePester.ps1" -JumpCloudApiKey << parameters.JumpCloudApiKey >> -JumpCloudApiKeyMsp << parameters.JumpCloudApiKeyMsp >> -ExcludeTagList << parameters.ExcludeTagList >> -IncludeTagList << parameters.IncludeTagList >> -RequiredModulesRepo << parameters.RequiredModulesRepo >>
565+
. "./PowerShell/JumpCloud Module/Tests/InvokePester.ps1" -JumpCloudApiKey << parameters.JumpCloudApiKey >> -JumpCloudApiKeyMsp << parameters.JumpCloudApiKeyMsp >> -JumpCloudMspOrg << parameters.JumpCloudMspOrg >> -ExcludeTagList << parameters.ExcludeTagList >> -IncludeTagList << parameters.IncludeTagList >> -RequiredModulesRepo << parameters.RequiredModulesRepo >>
543566
- store_test_results:
544567
name: Uploading test results'
545568
path: "./PowerShell/JumpCloud Module/Tests/test_results/"

PowerShell/Deploy/Get-Config.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ param (
1010
[Parameter(Mandatory = $false, ValueFromPipelineByPropertyName = $true, HelpMessage = 'Release Type')][ValidateNotNullOrEmpty()][System.String]$ReleaseType,
1111
[Parameter(Mandatory = $false, ValueFromPipelineByPropertyName = $true, HelpMessage = 'Windows Pester JumpCloud API Key')][ValidateNotNullOrEmpty()][System.String]$XAPIKEY_PESTER = $env:XAPIKEY_PESTER,
1212
[Parameter(Mandatory = $false, ValueFromPipelineByPropertyName = $true, HelpMessage = 'MTP Pester JumpCloud API Key')][ValidateNotNullOrEmpty()][System.String]$XAPIKEY_MTP = $env:XAPIKEY_PESTER_MTP,
13+
[Parameter(Mandatory = $false, ValueFromPipelineByPropertyName = $true, HelpMessage = 'MTP Pester JumpCloud API Key')][ValidateNotNullOrEmpty()][System.String]$XMSP_ORGID = $env:XORGID_PesterMSP,
1314
[Parameter(Mandatory = $false, ValueFromPipelineByPropertyName = $true, HelpMessage = 'Nuget API Key')][System.String]$NUGETAPIKEY = $env:NUGETAPIKEY,
1415
[Parameter(Mandatory = $false, ValueFromPipelineByPropertyName = $true, HelpMessage = 'Required Modules Repository')][ValidateNotNullOrEmpty()][System.String]$RequiredModulesRepo = "PSGallery"
1516
)
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
---
2+
external help file: JumpCloud-help.xml
3+
Module Name: JumpCloud
4+
online version: https://github.com/TheJumpCloud/support/wiki/
5+
schema: 2.0.0
6+
---
7+
8+
# Import-JCMSPFromCSV
9+
10+
## SYNOPSIS
11+
12+
Imports a list of JumpCloud MSP organizations from a CSV file created using the New-JCMSPImportTemplate function.
13+
14+
## SYNTAX
15+
16+
### GUI (Default)
17+
```
18+
Import-JCMSPFromCSV [-CSVFilePath] <String> [<CommonParameters>]
19+
```
20+
21+
### force
22+
```
23+
Import-JCMSPFromCSV [-CSVFilePath] <String> [-force] [-ProviderID <String>] [<CommonParameters>]
24+
```
25+
26+
## DESCRIPTION
27+
28+
The Import-JCMSPFromCSV function does data validation when updating JumpCloud Organizations in bulk from a CSV file to warn the administrator of any potential issues during the import process. Examples of warnings include warning messages for organizations whose name already exists and duplicate organization names in the CSV file.
29+
30+
The Import-JCMSPFromCSV command can be used to import organization names and max user counts.
31+
32+
The Import-JCMSPFromCSV command also has a '-force' parameter which admins can use to skip the gui validation or to use the function in an automation script.
33+
34+
## EXAMPLES
35+
36+
### Example 1
37+
38+
```powershell
39+
PS C:\> Import-JCMSPFromCSV ./JCMSPImport_06-14-2023.csv
40+
```
41+
42+
Imports MSP orgs from the .csv file 'JCMSPImport_06-14-2023.csv'
43+
44+
### Example 2
45+
46+
```powershell
47+
PS C:\> Import-JCMSPFromCSV ./JCMSPImport_06-14-2023.csv -Force
48+
```
49+
50+
Uses the 'Force' parameter to skip the GUI and data validation and import MSP orgs from the file 'JCMSPImport_06-14-2023.csv
51+
52+
## PARAMETERS
53+
54+
### -CSVFilePath
55+
56+
The full path to the CSV file you wish to import.
57+
You can use tab complete to search for .csv files.
58+
59+
```yaml
60+
Type: System.String
61+
Parameter Sets: (All)
62+
Aliases:
63+
64+
Required: True
65+
Position: 0
66+
Default value: None
67+
Accept pipeline input: False
68+
Accept wildcard characters: False
69+
```
70+
71+
### -force
72+
73+
A SwitchParameter which suppresses the GUI and data validation when using the Import-JCMSPFromCSV command.
74+
75+
```yaml
76+
Type: System.Management.Automation.SwitchParameter
77+
Parameter Sets: force
78+
Aliases:
79+
80+
Required: False
81+
Position: Named
82+
Default value: None
83+
Accept pipeline input: False
84+
Accept wildcard characters: False
85+
```
86+
87+
### -ProviderID
88+
89+
Your Provider ID
90+
91+
```yaml
92+
Type: System.String
93+
Parameter Sets: force
94+
Aliases:
95+
96+
Required: False
97+
Position: Named
98+
Default value: None
99+
Accept pipeline input: False
100+
Accept wildcard characters: False
101+
```
102+
103+
### CommonParameters
104+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
105+
106+
## INPUTS
107+
108+
### None
109+
110+
## OUTPUTS
111+
112+
### System.Object
113+
## NOTES
114+
115+
## RELATED LINKS

PowerShell/JumpCloud Module/Docs/JumpCloud.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Module Name: JumpCloud
33
Module Guid: 31c023d1-a901-48c4-90a3-082f91b31646
44
Download Help Link: https://github.com/TheJumpCloud/support/wiki
5-
Help Version: 2.5.1
5+
Help Version: 2.6.0
66
Locale: en-US
77
---
88

@@ -108,6 +108,9 @@ Returns the User Group members of a JumpCloud User Group.
108108
### [Import-JCCommand](Import-JCCommand.md)
109109
Imports a Mac, Linux or Windows JumpCloud Command into the JumpCloud admin portal from a URL
110110

111+
### [Import-JCMSPFromCSV](Import-JCMSPFromCSV.md)
112+
Imports a list of JumpCloud MSP organizations from a CSV file created using the New-JCMSPImportTemplate function.
113+
111114
### [Import-JCUsersFromCSV](Import-JCUsersFromCSV.md)
112115
Imports a set of JumpCloud users from a CSV file created using the New-JCImportTemplate function.
113116

@@ -126,6 +129,9 @@ A guided walk through that creates a command deployment CSV file on your local m
126129
### [New-JCImportTemplate](New-JCImportTemplate.md)
127130
A guided walk through that creates a JumpCloud User Import CSV file on your local machine.
128131

132+
### [New-JCMSPImportTemplate](New-JCMSPImportTemplate.md)
133+
Creates a CSV file to either create new or update existing MSP organizations in a MSP tenant.
134+
129135
### [New-JCPolicy](New-JCPolicy.md)
130136
New-JCPolicy creates new JumpCloud Policies in an organization by TemplateID or TemplateNames. JumpCloud policies can be created in three different ways. The New/Set-JCPolicy functions each have a dynamic set of parameters specific to each policy template, this dynamic set of parameters is generated after specifying a valid TemplateID or TemplateName. New/Set-JCPolicy functions can also be set through a valid `value` parameter which is specific to each template policy. Lastly, New/Set-JCPolicy functions can be set through a guided interface.
131137

@@ -227,6 +233,9 @@ The Set-JCUserGroupLDAP command adds or removes a JumpCloud user group and the m
227233
### [Update-JCModule](Update-JCModule.md)
228234
Running this function will trigger the update of the JumpCloud PowerShell module.
229235

236+
### [Update-JCMSPFromCSV](Update-JCMSPFromCSV.md)
237+
Updates a list of JumpCloud MSP organizations from a CSV file created using the New-JCMSPImportTemplate function.
238+
230239
### [Update-JCUsersFromCSV](Update-JCUsersFromCSV.md)
231240
Updates a set of JumpCloud users from a CSV file created using the New-JCImportTemplate function.
232241

PowerShell/JumpCloud Module/Docs/New-JCImportTemplate.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ schema: 2.0.0
88
# New-JCImportTemplate
99

1010
## SYNOPSIS
11+
1112
A guided walk through that creates a JumpCloud User Import CSV file on your local machine.
1213

1314
## SYNTAX
@@ -17,6 +18,7 @@ New-JCImportTemplate [-Force] -Type <Object> [<CommonParameters>]
1718
```
1819

1920
## DESCRIPTION
21+
2022
The New-JCImportTemplate command is a menu driven function that guides end users and creates a custom JumpCloud User Import .CSV file on their machine for populating with their users information for Importing into JumpCloud.
2123
If users wish to bind users to existing JumpCloud systems the function will also output a .csv file with containing all existing JumpCloud machines to the users $Home directory. The user will need this file to associate SystemIDs with new users.
2224

@@ -29,6 +31,7 @@ If users wish to bind users to existing JumpCloud systems the function will also
2931
[Advanced User Import](https://youtu.be/L2hP-XtUJH8)
3032

3133
### Example 1
34+
3235
```powershell
3336
PS C:\> New-JCImportTemplate
3437
```
@@ -38,7 +41,8 @@ Launches the New-JCImportTemplate menu
3841
## PARAMETERS
3942

4043
### -Force
41-
Parameter to force populate CSV with all headers when creating an update template. When selected this option will forcefully replace existing files in the current working directory. i.e. If you
44+
45+
Parameter to force populate CSV with all headers when creating an update template. When selected this option will forcefully replace existing files in the current working directory.
4246

4347
```yaml
4448
Type: System.Management.Automation.SwitchParameter
@@ -53,6 +57,7 @@ Accept wildcard characters: False
5357
```
5458
5559
### -Type
60+
5661
Type of CSV to Create. Update or Import are valid options.
5762
5863
```yaml
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
external help file: JumpCloud-help.xml
3+
Module Name: JumpCloud
4+
online version: https://github.com/TheJumpCloud/support/wiki/
5+
schema: 2.0.0
6+
---
7+
8+
# New-JCMSPImportTemplate
9+
10+
## SYNOPSIS
11+
12+
Creates a CSV file to either create new or update existing MSP organizations in a MSP tenant.
13+
14+
## SYNTAX
15+
16+
```
17+
New-JCMSPImportTemplate [-Force] [-Type <Object>] [<CommonParameters>]
18+
```
19+
20+
## DESCRIPTION
21+
22+
The New-JCMSPImportTemplate command is a menu driven function that creates a CSV template for the `Update-JCMSPFromCSV` and `Import-JCMSPFromCSV` functions. Templates for updated existing orgs are populated with the ids, names and max user counts of existing orgs. The template for new organizations is populated with only a name and max user count column.
23+
24+
## EXAMPLES
25+
26+
### Example 1
27+
28+
```powershell
29+
PS C:\> New-JCMSPImportTemplate
30+
```
31+
32+
Launches the New-JCMSPImportTemplate menu
33+
34+
## PARAMETERS
35+
36+
### -Force
37+
38+
Parameter to force populate CSV with all headers when creating an update template.
39+
When selected this option will forcefully replace existing files in the current working directory.
40+
i.e.
41+
If you
42+
43+
```yaml
44+
Type: System.Management.Automation.SwitchParameter
45+
Parameter Sets: (All)
46+
Aliases:
47+
48+
Required: False
49+
Position: Named
50+
Default value: None
51+
Accept pipeline input: False
52+
Accept wildcard characters: False
53+
```
54+
55+
### -Type
56+
57+
Type of CSV to Create.
58+
Update or Import are valid options.
59+
60+
```yaml
61+
Type: System.Object
62+
Parameter Sets: (All)
63+
Aliases:
64+
Accepted values: Import, Update
65+
66+
Required: False
67+
Position: Named
68+
Default value: None
69+
Accept pipeline input: False
70+
Accept wildcard characters: False
71+
```
72+
73+
### CommonParameters
74+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
75+
76+
## INPUTS
77+
78+
### None
79+
80+
## OUTPUTS
81+
82+
### System.Object
83+
## NOTES
84+
85+
## RELATED LINKS

PowerShell/JumpCloud Module/Docs/Set-JCSettingsFile.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Updates the JumpCloud Module Settings File
1414
## SYNTAX
1515

1616
```
17-
Set-JCSettingsFile [-moduleBannerMessageCount <PSObject>] [-parallelOverride <PSObject>] [<CommonParameters>]
17+
Set-JCSettingsFile [-parallelOverride <PSObject>] [-moduleBannerMessageCount <PSObject>] [<CommonParameters>]
1818
```
1919

2020
## DESCRIPTION

0 commit comments

Comments
 (0)