DEV Community

Cover image for Citrix CVAD Cloud Api Scripting
Warlock
Warlock

Posted on

Citrix CVAD Cloud Api Scripting

I created a PowerShell wrapper module for Citrix Cloud CVAD API, the original goal was just to understand the new API and to see what would be possible. But it ended up allowing me to automate tasks, that I previously gave up on because of Windows and Windows PowerShell versioning ext.

Using this module, I was able to rewrite all my PowerShell scripts for on-prem environments, without needing the Citrix PSSnapins. This enabled me to move my setup to PowerShell 7 with ease. My next goal is to run everything from a non-Windows system and then some actions/tasks from GitHub Actions or Azure DevOps Pipelines.

Managing multiple clients is also much simpler now, I reuse the same scripts between all my clients to create their Daily and Monthly reporting. All I need to change is the API Token, and the module takes care of the rest.

I hope this will help other Citrix Admins out there and make their lives a bit easier. Please contact me on LinkedIn or GitHub for any bugs or enhancements.

Follow these steps to get started:

Getting Started

You will need access to the Citrix Cloud API. Follow Get API Access to gain access.

Install-Module -Name CTXCloudApi -Verbose
Import-Module CTXCloudApi -Verbose -Force
Get-Command -Module CTXCloudApi
or
Get-Help About_CTXCloudApi

Run Connect-CTXAPI with the details obtained from Citrix Cloud. This will connect and create the needed headers for other commands.

Example 1:

$splat = @{
Customer_Id = "xxx"
Client_Id = "xxx-xxx-xxx-xxx"
Client_Secret = "yyyyyy=="
Customer_Name = 'HomeLab'
}
$APIHeader = Connect-CTXAPI @splat
Get-CTXAPI_HealthCheck -APIHeader $APIHeader -region eu -ReportPath C:\Temp\

Top comments (0)