PowerShell module to managed Aruba Central (Cloud)
This is a Powershell module for manage Aruba Central
With this module (version 0.2.0) you can manage:
There is some extra feature
More functionality will be added later.
Tested with Aruba Central ( Region EU-1 )
All resource management functions are available with the Powershell verbs GET, ADD, SET, REMOVE.
<!—For example, you can manage NAS (NetworkDevice) with the following commands:
Get-ArubaCPNetworkDevice
Add-ArubaCPNetworkDevice
Set-ArubaCPNetworkDevice
Remove-ArubaCPNetworkDevice
—>
Powershell 5 or 6.x/7.x (Core) (If possible get the latest version)
# Automated installation (Powershell 5 and later):
Install-Module PowerArubaCL
# Import the module
Import-Module PowerArubaCL
# Get commands in the module
Get-Command -Module PowerArubaCL
# Get help
Get-Help Add-ArubaCLInventoryDevices -Full
The first thing to do is to get API client_id/client_secret and customer_id
Go on WebGUI of your Aruba Central, on API Gateway (in the Account Home Page)
Go on My Apps & Tokens
or System Apps & Tokens
(for Admin Account) and click on Add Apps & Tokens
Create a New Token
Click on Generate
now copy Client ID
and Client Secret
, you will need for connect
Go now on the configuration for get the customer id
it is available on the top right
Copy Customer ID
value
After connect to Aruba Central with the command Connect-ArubaCL
:
# Connect to the Aruba Central using Token
Connect-ArubaCL -region EU-1 -client_id MyClientId -client_secret MyClientSecret -customer_id MyCustomerId
PowerShell credential request
Please enter administrative credential for your Aruba Central
User: cl@poweraruba.net
Password for user cl@poweraruba.net: **********
Name Value
---- -----
session Microsoft.PowerShell.Commands.WebRequestSession
invokeParams {}
server eu-apigw.central.arubanetworks.com
access_token 565kubYCyDEEaJ4s3zs40yvgtxGTG4Lv
headers {Content-type, Accept, Authorization}
You can get Inventory Devices
# get IAP Devices
Get-ArubaCLInventoryDevices -type IAP
aruba_part_no : AP-505-RW
customer_id : 987b69ccdfb03124feeb4a847b9f54d2
customer_name : PowerArubaCL
device_type : iap
imei :
macaddr : B8:3A:5A:1C:22:1C
model : R2H28A
serial : CNJNK0N7PP
services : {}
tier_type :
...
# Add Devices (need to known Mac Address and Serial Number)
Add-ArubaCLInventoryDevices -mac FC:7F:F2:88:11:22 -serial CNLBAD3C5DT
success
# Get Device Stats
Get-ArubaCLInventoryDevicesStats -type IAP -service dm
licensed total
-------- -----
44 99
# Get Archived Devices
Get-ArubaCLInventoryDevicesArchive
aruba_part_no : AP-505-RW
customer_id : 987b69ccdfb03124feeb4a847b9f54d2
customer_name : PowerArubaCL
device_type : iap
imei :
macaddr : B8:3A:5A:1C:22:1C
model : R2H28A
serial : CNJNK0N7PP
# Add Devices to Archive (need to known Serial Number)
Add-ArubaCLInventoryDevicesArchive -serial CNJNK0N7PP
success
# Remove Devices to Archive (need to known Serial Number)
Remove-ArubaCLInventoryDevicesArchive -serial CNJNK0N7PP
success
for example to get
# get list of Group
Invoke-ArubaCLRestMethod -uri "configuration/v2/groups?limit=20&offset=0"
data total
---- -----
{MyPowerArubaCL-Group} 1
to get API uri, go to Aruba Central Swagger (https://eu-apigw.central.arubanetworks.com/swagger/central)
(need to be connected)
it is possible to connect on same times to Aruba Central account
You need to use -connection parameter to cmdlet
For example to get Devices for 2 different Aruba Central account
# Connect to first Aruba Central Account
$cl1 = Connect-ArubaCL -Region EU-1 -DefaultConnection:$false
#DefaultConnection set to false is not mandatory but only don't set the connection info on global variable
# Connect to second Aruba Central Account
$cl2 = Connect-ArubaCL -Region EU-1 -DefaultConnection:$false
# Get number of Devices of first Aruba Central Account
(Get-ArubaCLInventoryDevices -type IAP -connection $cl1).count
80
# Get number of Devices of Second Aruba Central Account
(Get-ArubaCLInventoryDevices -type IAP -connection $cl2).count
90
#Each cmdlet can use -connection parameter
By default, the (access) token is valid for 7200 seconds (2 hours), PowerArubaCL store the refreshtoken (valid for 14days ?)
and automatically update (access) token when it is expired (or it will be expire on less of 15 minutes).
If you need to renew token before you can use _Update-ArubaCLRefreshToken cmdlet
Following API call, it is possible to have a limit return result.
For Example Get-ArubaCLInventoryDevices return by default only the 50th first devices.
if there is more of 50 devices, you get a warning,
(Get-ArubaCLInventoryDevices -type IAP).count
WARNING: There is extra items use -limit parameter to display
50
it is possible to specific the limit and the offset
(Get-ArubaCLInventoryDevices -type IAP -limit 1000).count
365
For Invoke-ArubaCLRestMethod
, you can also use limit and offset parameter
# Disconnect from Aruba Central
Disconnect-ArubaCL
Contribution and feature requests are more than welcome. Please use the following methods:
Currently, @alagoutte started this project and will keep maintaining it. Reach out to me via Twitter, Email (see top of file) or the issues Page here on GitHub. If you want to contribute, also get in touch with me.
Add-ArubaCLInventoryDevices
Add-ArubaCLInventoryDevicesArchive
Connect-ArubaCL
Disconnect-ArubaCL
Format-ArubaCLMacAddress
Get-ArubaCLInventoryDevices
Get-ArubaCLInventoryDevicesArchive
Get-ArubaCLInventoryDevicesStats
Get-ArubaCLTokenStatus
Invoke-ArubaCLRestMethod
Remove-ArubaCLInventoryDevicesArchive
Set-ArubaCLCipherSSL
Show-ArubaCLException
Update-ArubaCLRefreshToken
Alexis La Goutte
Sort by name (git shortlog -s)
Copyright 2021 Alexis La Goutte and the community.