How pspete/pspas works
Project Type & Purpose
• This is an open-source PowerShell module (“psPAS”) that wraps the CyberArk PVWA REST API, exposing all API capabilities (up to v14.0) as PowerShell cmdlets.
• It provides authentication (multiple flows), account management, safe and policy operations, PSM session control, PTA rules, etc., for automation in PowerShell.
File Structure Analysis
• Top-level:
• psPAS/ – the PowerShell module code:
– psPAS.psd1 & psPAS.psm1 (module manifest & entry)
– Functions/ (public cmdlet implementations, organized by domain: Authentication, Accounts, Safes…)
– Private/ (internal helpers: HTTP calls, JSON processing, version checks)
– xml/ (PowerShell formatting & type definitions)
– en-US/ (help XML)
• Tests/ – a large suite of Pester-style .ps1 tests, one per cmdlet
• build/ – build & deployment scripts (test, package, deploy to PSGallery & GitHub)
• docs/ – Jekyll website source for documentation
• CI/CD & deployment:
– appveyor.yml invokes build/test scripts
– build/deploy-github.ps1 publishes docs to GitHub Pages
– build/deploy-psgallery.ps1 pushes module to PowerShell Gallery
Key Components
a. User & Host:
– PowerShell Console/Script invokes psPAS cmdlets
b. psPAS Module Layers:
1) Public Cmdlets (Functions/)
2) Private Helpers (Private/) – HTTP/REST wrapper, parameter conversion, version checks
3) Type & Format Definitions (xml/)
c. External Systems:
– CyberArk PVWA REST API (HTTPS endpoints)
– CI/CD Services: AppVeyor, GitHub Actions (build/test)
– PowerShell Gallery (module publishing)
– GitHub Pages (docs hosting via Jekyll)
d. Testing:
– Tests/ – Pester tests invoking Public Cmdlets against a mock or real API during CI
e. Documentation Pipeline:
– docs/ site source → Jekyll build → GitHub Pages
Relationships & Data Flows
• PowerShell Console → loads psPAS.psm1 → exposes Public Cmdlets
• Public Cmdlets → call Private Helpers → execute Invoke-PASRestMethod → send HTTPS request → CyberArk PVWA
• PVWA → returns JSON → Private Helpers parse JSON → convert to PSObjects → returned to user
• Tests invoke Public Cmdlets → validate behavior (mock or live API)
• CI (AppVeyor) triggers build.ps1 → runs tests → on success deploys artifacts:
• Module → PowerShell Gallery
• docs/ → GitHub Pages
Architectural Patterns & Principles
• Modular design: commands organized by functional domain
• Separation of concerns: Public interface (cmdlets) vs Private utilities vs type/format definitions
• Declarative manifest (psd1/psm1) to manage module loading
• CI/CD pipelines automated via scripts
• Static site generation for docs