-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from BNWEIN/Dev
Update to 1.1.9
- Loading branch information
Showing
11 changed files
with
316 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
CIPPAPIModule/public/CIPP/Settings/Get-CIPPExtensionMapping.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<# | ||
.SYNOPSIS | ||
Retrieves the extension mapping for a specified extension name. | ||
.DESCRIPTION | ||
The Get-CIPPExtensionMapping function calls an API endpoint to get the extension mapping for a given extension name. | ||
The function supports the following extension names: "HaloPSA", "NinjaOne", "NinjaOneFields", "Hudu", and "HuduFields". | ||
.PARAMETER ExtensionName | ||
The name of the extension for which to retrieve the mapping. This parameter is mandatory and accepts the following values: | ||
"HaloPSA", "NinjaOne", "NinjaOneFields", "Hudu", "HuduFields". | ||
.EXAMPLE | ||
PS C:\> Get-CIPPExtensionMapping -ExtensionName "HaloPSA" | ||
This example retrieves the extension mapping for the "HaloPSA" extension. | ||
.NOTES | ||
This function uses the Invoke-CIPPRestMethod cmdlet to call the API endpoint. | ||
#> | ||
function Get-CIPPExtensionMapping { | ||
[CmdletBinding()] | ||
Param( | ||
[Parameter(Mandatory = $true)] | ||
[ValidateSet( | ||
"HaloPSA", | ||
"NinjaOne", | ||
"NinjaOneFields", | ||
"Hudu", | ||
"HuduFields")] | ||
[string]$ExtensionName | ||
) | ||
|
||
Write-Verbose 'Getting Extension Mapping' | ||
|
||
$endpoint = '/api/ExecExtensionMapping' | ||
$params = @{ | ||
List = $ExtensionName | ||
} | ||
|
||
Invoke-CIPPRestMethod -Endpoint $endpoint -Params $params | ||
} |
67 changes: 67 additions & 0 deletions
67
CIPPAPIModule/public/CIPP/Settings/Set-CIPPExtensionMappingHaloPSA.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<# | ||
.SYNOPSIS | ||
Sets the extension mapping for HaloPSA in the CIPP system. | ||
.DESCRIPTION | ||
The Set-CIPPExtensionMappingHaloPSA function sets the extension mapping for HaloPSA by adding or updating the mapping for a specified tenant. It retrieves the current extension mappings, updates them with the provided Halo client information, and sends the updated mappings to the CIPP system via a REST API call. | ||
.PARAMETER HaloClientID | ||
The ID of the Halo client. This parameter is mandatory. | ||
.PARAMETER HaloClientName | ||
The name of the Halo client. This parameter is mandatory. | ||
.PARAMETER TenantID | ||
The ID of the tenant for which the extension mapping is being set. This parameter is mandatory. | ||
.EXAMPLE | ||
Set-CIPPExtensionMappingHaloPSA -HaloClientID "12345" -HaloClientName "ExampleClient" -TenantID "7174f39b-33c6-4226-a67b-67fc1f127ef5" | ||
This example sets the extension mapping for the Halo client with ID "12345" and name "ExampleClient" for the tenant with ID "67890". | ||
#> | ||
function Set-CIPPExtensionMappingHaloPSA { | ||
[CmdletBinding()] | ||
Param( | ||
[Parameter(Mandatory = $true)] | ||
[string]$HaloClientID, | ||
[Parameter(Mandatory = $true)] | ||
[string]$HaloClientName, | ||
[Parameter(Mandatory = $true)] | ||
[string]$TenantID | ||
) | ||
|
||
Write-Verbose 'Setting Extension Mapping' | ||
|
||
$endpoint = '/api/ExecExtensionMapping' | ||
$params = @{ | ||
AddMapping = "HaloPSA" | ||
} | ||
|
||
$ExtensionMappings = Get-CIPPExtensionMapping -ExtensionName HaloPSA | ||
|
||
# Convert the JSON string to a PowerShell object | ||
$jsonObject = $ExtensionMappings.mappings | ||
|
||
# Convert the PSCustomObject to a hashtable for modification | ||
$jsonHashtable = @{} | ||
$jsonObject.PSObject.Properties | ForEach-Object { | ||
$jsonHashtable[$_.Name] = $_.Value | ||
} | ||
|
||
# Add the new key-value pair to the hashtable | ||
$jsonHashtable[$TenantID] = @{ | ||
value = $HaloClientID | ||
label = $HaloClientName | ||
} | ||
|
||
# Convert the updated hashtable back to JSON | ||
$json = $jsonHashtable | ConvertTo-Json -Depth 10 | ||
|
||
$output = $json | ConvertFrom-Json | ||
|
||
$Body = @{ | ||
mappings = $output | ||
} | ||
|
||
Invoke-CIPPRestMethod -Endpoint $endpoint -Params $params -Body $Body -Method Post | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<# | ||
.SYNOPSIS | ||
Creates a GDAP (Granular Delegated Admin Privileges) invite. | ||
.DESCRIPTION | ||
The Get-CIPPGDAPInvite function sends a request to create a GDAP invite using the specified GDAP roles. | ||
You can either provide a custom set of roles using the `-GDAPRoles` parameter or include all existing roles by using the `-UseAllExistingRoles` switch. | ||
.PARAMETER GDAPRoles | ||
An array of GDAP roles to be included in the invite. Each role is represented as a hashtable with the following keys: | ||
- `GroupName`: The name of the role group. | ||
- `GroupId`: The unique identifier of the role group. | ||
- `RoleName`: The name of the specific role. | ||
- `roleDefinitionId`: The unique identifier for the role definition. | ||
.PARAMETER UseAllExistingRoles | ||
A switch parameter that, when specified, includes all existing roles in the GDAP invite. This is mutually exclusive with `-GDAPRoles`. | ||
.EXAMPLE | ||
PS C:\> Get-CIPPGDAPInvite -GDAPRoles @(@{GroupName="M365 GDAP Cloud Device Administrator";GroupId="fa03defa-27c4-4639-8e50-14cbb746a78d";RoleName="Cloud Device Administrator";roleDefinitionId="7698a772-787b-4ac8-901f-60d6b08affd2"},@{GroupName="M365 GDAP Intune Administrator";GroupId="3d1c917f-8d1e-4a1e-a61c-df3263a0d1bc";RoleName="Intune Administrator";roleDefinitionId="3a2c62db-5318-420d-8d74-23affee5d9d5"}) | ||
This example creates a GDAP invite with the roles "Cloud Device Administrator" and "Intune Administrator." | ||
.EXAMPLE | ||
PS C:\> Get-CIPPGDAPInvite -UseAllExistingRoles | ||
This example creates a GDAP invite including all existing roles retrieved by the `Get-CIPPGDAPRoles` function. | ||
.NOTES | ||
- This function uses the `Invoke-CIPPRestMethod` cmdlet to send the request to the `/api/ExecGDAPInvite` endpoint. | ||
- You must specify either `-GDAPRoles` or `-UseAllExistingRoles`, but not both. | ||
- Ensure the GDAP roles are valid and correctly formatted before calling this function. | ||
#> | ||
|
||
function Get-CIPPGDAPInvite { | ||
[CmdletBinding()] | ||
Param( | ||
[Parameter(Mandatory = $false)] | ||
[array]$GDAPRoles, | ||
[Parameter(Mandatory = $false)] | ||
[switch]$UseAllExistingRoles | ||
) | ||
|
||
if ($GDAPRoles -and $UseAllExistingRoles) { | ||
throw 'Cannot specify both GDAPRoles and UseAllExistingRoles' | ||
} | ||
|
||
if (-not $GDAPRoles -and -not $UseAllExistingRoles) { | ||
throw 'Must specify either GDAPRoles or UseAllExistingRoles' | ||
} | ||
|
||
if ($UseAllExistingRoles) { | ||
Write-Verbose 'Using all existing roles for GDAP Invite' | ||
$GDAPRoles = Get-CIPPGDAPRoles | ||
} | ||
|
||
Write-Verbose 'Creating GDAP Invite' | ||
|
||
$endpoint = '/api/ExecGDAPInvite' | ||
|
||
$Body = @{ | ||
gdapRoles = $GDAPRoles | ||
} | ||
|
||
Invoke-CIPPRestMethod -Endpoint $endpoint -Body $Body | ||
} |
31 changes: 31 additions & 0 deletions
31
CIPPAPIModule/public/Tenant/Standards/Remove-CIPPStandard.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<# | ||
.SYNOPSIS | ||
Removes standards for a specified customer domain. | ||
.DESCRIPTION | ||
The Remove-CIPPStandard function removes standards associated with a given customer domain by calling the appropriate API endpoint. | ||
.PARAMETER CustomerDefaultDomain | ||
The default domain of the customer for which the standards are to be removed. This parameter is mandatory. | ||
.EXAMPLE | ||
Remove-CIPPStandard -CustomerDefaultDomain "example.com" | ||
This example removes the standards for the customer with the default domain "example.com". | ||
.NOTES | ||
This function uses the Invoke-CIPPRestMethod cmdlet to call the API endpoint. | ||
#> | ||
function Remove-CIPPStandard { | ||
[CmdletBinding()] | ||
Param( | ||
[Parameter(Mandatory = $true)] | ||
[string]$CustomerDefaultDomain | ||
) | ||
|
||
Write-Verbose "Removing standards for $CustomerTenantID" | ||
$endpoint = '/api/RemoveStandard' | ||
$params = @{ | ||
ID = $CustomerDefaultDomain | ||
} | ||
Invoke-CIPPRestMethod -Endpoint $endpoint -Params $params | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Get-CIPPExtensionMapping | ||
## SYNOPSIS | ||
Retrieves the extension mapping for a specified extension name. | ||
## DESCRIPTION | ||
The Get-CIPPExtensionMapping function calls an API endpoint to get the extension mapping for a given extension name. | ||
The function supports the following extension names: "HaloPSA", "NinjaOne", "NinjaOneFields", "Hudu", and "HuduFields". | ||
# PARAMETERS | ||
|
||
## **-ExtensionName** | ||
>   \ | ||
The name of the extension for which to retrieve the mapping. This parameter is mandatory and accepts the following values: "HaloPSA", "NinjaOne", "NinjaOneFields", "Hudu", "HuduFields". | ||
|
||
#### EXAMPLE 1 | ||
```powershell | ||
PS C:\>Get-CIPPExtensionMapping -ExtensionName "HaloPSA" | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Get-CIPPGDAPInvite | ||
## SYNOPSIS | ||
Creates a GDAP (Granular Delegated Admin Privileges) invite. | ||
## DESCRIPTION | ||
The Get-CIPPGDAPInvite function sends a request to create a GDAP invite using the specified GDAP roles. | ||
You can either provide a custom set of roles using the `-GDAPRoles` parameter or include all existing roles by using the `-UseAllExistingRoles` switch. | ||
# PARAMETERS | ||
|
||
## **-GDAPRoles** | ||
>   \ | ||
An array of GDAP roles to be included in the invite. Each role is represented as a hashtable with the following keys: - `GroupName`: The name of the role group. - `GroupId`: The unique identifier of the role group. - `RoleName`: The name of the specific role. - `roleDefinitionId`: The unique identifier for the role definition. | ||
|
||
## **-UseAllExistingRoles** | ||
>   \ | ||
A switch parameter that, when specified, includes all existing roles in the GDAP invite. This is mutually exclusive with `-GDAPRoles`. | ||
|
||
#### EXAMPLE 1 | ||
```powershell | ||
PS C:\>Get-CIPPGDAPInvite -GDAPRoles @(@{GroupName="M365 GDAP Cloud Device Administrator";GroupId="fa03defa-27c4-4639-8e50-14cbb746a78d";RoleName="Cloud Device Administrator";roleDefinitionId="7698a772-787b-4ac8-901f-60d6b08affd2"},@{GroupName="M365 GDAP Intune Administrator";GroupId="3d1c917f-8d1e-4a1e-a61c-df3263a0d1bc";RoleName="Intune Administrator";roleDefinitionId="3a2c62db-5318-420d-8d74-23affee5d9d5"}) | ||
This example creates a GDAP invite with the roles "Cloud Device Administrator" and "Intune Administrator." | ||
``` | ||
#### EXAMPLE 2 | ||
```powershell | ||
PS C:\>Get-CIPPGDAPInvite -UseAllExistingRoles | ||
This example creates a GDAP invite including all existing roles retrieved by the `Get-CIPPGDAPRoles` function. | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Remove-CIPPStandard | ||
## SYNOPSIS | ||
Removes standards for a specified customer domain. | ||
## DESCRIPTION | ||
The Remove-CIPPStandard function removes standards associated with a given customer domain by calling the appropriate API endpoint. | ||
# PARAMETERS | ||
|
||
## **-CustomerDefaultDomain** | ||
>   \ | ||
The default domain of the customer for which the standards are to be removed. This parameter is mandatory. | ||
|
||
#### EXAMPLE 1 | ||
```powershell | ||
PS > Remove-CIPPStandard -CustomerDefaultDomain "example.com" | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Set-CIPPExtensionMappingHaloPSA | ||
## SYNOPSIS | ||
Sets the extension mapping for HaloPSA in the CIPP system. | ||
## DESCRIPTION | ||
The Set-CIPPExtensionMappingHaloPSA function sets the extension mapping for HaloPSA by adding or updating the mapping for a specified tenant. It retrieves the current extension mappings, updates them with the provided Halo client information, and sends the updated mappings to the CIPP system via a REST API call. | ||
# PARAMETERS | ||
|
||
## **-HaloClientID** | ||
>   \ | ||
The ID of the Halo client. This parameter is mandatory. | ||
|
||
## **-HaloClientName** | ||
>   \ | ||
The name of the Halo client. This parameter is mandatory. | ||
|
||
## **-TenantID** | ||
>   \ | ||
The ID of the tenant for which the extension mapping is being set. This parameter is mandatory. | ||
|
||
#### EXAMPLE 1 | ||
```powershell | ||
PS > Set-CIPPExtensionMappingHaloPSA -HaloClientID "12345" -HaloClientName "ExampleClient" -TenantID "7174f39b-33c6-4226-a67b-67fc1f127ef5" | ||
``` | ||
|
Oops, something went wrong.