This is the code for a PowerShell module for TD Synnex ION. It is a work in progress and it does have a generic 'Invoke-TDRestMethod' available so you can make any API call you want. See advanced usage examples below.
The module is written for PowerShell 7.
More info on the API can be found HERE
IONModule provides a PowerShell wrapper around the ION API. The module handles all the authentication for you. All you need to do is supply your ION API Refresh Token using the 'Set-APIDetails' command.
You can get a Refresh Token by going into the user accounts section in the ION portal. Click into a user and under "OAth Credentials" you can request a refresh token. Refresh Tokens have a one time usage limit. You can read more on that HERE
This module is published to the PowerShell Gallery and can be installed from within PowerShell with Install-Module
Install-Module -Name IONModule
This module is updated regularly. Remember to always check for the latest version from within PowerShell with Update-Module
Update-Module -Name IONModule
Whilst this module can be used without an Azure Keyvault, you would need a new refresh token every 2 hours which is a manual process of going to the ION portal, and getting a new refresh token. This is because ION have made their refresh tokens single use. Instead I recommend you setup an Azure Keyvault, store your initial refresh token in the keyvault, and use the "Advanced" connection method mentioned HERE
Otherwise if you are going to manually enter your refresh token, please see below
- Set API Connection details
Set-APIDetails -Refreshtoken "YourRefreshTokenGoesHere" -AccountID "Your Account ID goes here"
- Test your first call to the API
Get-AccessTokenExpiry
If the above returns something similar to the below, then you are connected to the API
access_expires_in refresh_expires_in
----------------- ------------------
7199 2764774
- Set KeyVault Details
Set-KeyVaultDetails -AzureSubscriptionId "31df7912-4fc7-4ce7-b7a8-2cece6fbe51d" -KeyVaultName "YourKeyVaultName" -KeyVaultSecretName "YourKeyVaultSecretName" -AccountID "Your ION Account ID"
- Test your first call to the API
Get-AccessTokenExpiry
If the above returns something similar to the below, then you are connected to the API
access_expires_in refresh_expires_in
----------------- ------------------
7199 2764774
Add Azure Keyvault functionalityComplete- Add additional endpoints