Security

Reply
Highlighted
MVP Expert

PowerArubaCP : a powershell module for use ClearPass REST API

 

 

Hi,

 

I have been working for several months on a Powershell module that uses the ClearPass REST API.

 

This module is available on psgallery(.com) : https://www.powershellgallery.com/packages/PowerArubaCP/

 

Actually, we support to connect to HTTPS using Token API

and configure the following feature :

  •  NetworkDevice (NAS) : Add / Get /Remove
  • ...

it is very easy to use (and install)

 

Launch powershell command line and laucnh following command for install

 

Install-Module PowerArubaCP

for load the module

Import-Module PowerArubaCP

Connect to your ClearPass

Connect-ArubaCP 192.0.2.1 -token aaaaaaaaaaaaaaaaaaaaa

 

for example to get all Network Device (Nas)

Get-ArubaCPNetworkDevice

 

You can get the list of command available via

Get-Command -Module PowerArubaCP

 

 and for get help (and example about a command for example Add-ArubaCPNetworkDevice)

Get-Help Add-ArubaCPNetworkDevice -Full

More documentation, example is available on https://github.com/PowerAruba/PowerArubaCP and you can also report issue/enhance !

 

 

 




PowerArubaSW: Powershell Module to use Aruba Switch API for Vlan, VlanPorts, LACP, LLDP... More info


PowerArubaCP: Powershell Module to use ClearPass API (create NAD, Guest...) More info


PowerArubaCX: Powershell Module to use ArubaCX API (get interface/vlan/ports info)


PowerArubaIAP: Powershell Module to use Aruba Instant AP




ACMP 6.4 / ACMX #107 / ACCP 6.5
New Contributor

Re: PowerArubaCP : a powershell module for use ClearPass REST API

Thank you so much for creating this. I think it will be quite useful.

 

A question about syntax. I am trying to set a password for a local user account and no matter what I do, I can't seem to get the syntax correct. I am trying: 

 

Invoke-ArubaCPRestMethod -method "patch" -uri "api/local-user/3001" -body "{'password': 'NewPass123'}"

 

But PS always returns:

 

WARNING: The ClearPass API sends an error message:
WARNING: Error description (code): Internal Server Error (500)
WARNING: Error details: {"type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html","title":"Internal Server
Error","status":500,"detail":"Data provided to create must be either an array or object; received \"string\""}
Unable to use ClearPass API
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PowerArubaCP\Private\RestMethod.ps1:64 char:13
+ throw "Unable to use ClearPass API"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Unable to use ClearPass API:String) [], RuntimeException
+ FullyQualifiedErrorId : Unable to use ClearPass API

 

From the error, it would appear that the API is expecting an array in the body, but I've tried specifying multiple parameters in comma delimited format but still get the same error. Any help would be appreciated.


Thanks!

MVP Expert

Re: PowerArubaCP : a powershell module for use ClearPass REST API


dwisel@nea.com wrote:

Thank you so much for creating this. I think it will be quite useful.

 

A question about syntax. I am trying to set a password for a local user account and no matter what I do, I can't seem to get the syntax correct. I am trying: 

 

Invoke-ArubaCPRestMethod -method "patch" -uri "api/local-user/3001" -body "{'password': 'NewPass123'}"

 

But PS always returns:

 

WARNING: The ClearPass API sends an error message:
WARNING: Error description (code): Internal Server Error (500)
WARNING: Error details: {"type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html","title":"Internal Server
Error","status":500,"detail":"Data provided to create must be either an array or object; received \"string\""}
Unable to use ClearPass API
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PowerArubaCP\Private\RestMethod.ps1:64 char:13
+ throw "Unable to use ClearPass API"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Unable to use ClearPass API:String) [], RuntimeException
+ FullyQualifiedErrorId : Unable to use ClearPass API

 

From the error, it would appear that the API is expecting an array in the body, but I've tried specifying multiple parameters in comma delimited format but still get the same error. Any help would be appreciated.


Thanks!


Hi,

 

Can you open a issue on PowerArubaCP Github ? Better place for this

 




PowerArubaSW: Powershell Module to use Aruba Switch API for Vlan, VlanPorts, LACP, LLDP... More info


PowerArubaCP: Powershell Module to use ClearPass API (create NAD, Guest...) More info


PowerArubaCX: Powershell Module to use ArubaCX API (get interface/vlan/ports info)


PowerArubaIAP: Powershell Module to use Aruba Instant AP




ACMP 6.4 / ACMX #107 / ACCP 6.5
Search Airheads
cancel
Showing results for 
Search instead for 
Did you mean: