jakkulabs / PowervRA

:rocket: :wrench: vRealize Automation PowerShell Toolkit
MIT License
81 stars 45 forks source link

Feature: vRA Connection Profiles #163

Open chelnak opened 6 years ago

chelnak commented 6 years ago

@jonathanmedd Here's the first draft for connection profiles.

https://github.com/jakkulabs/PowervRA/tree/feature-profiles

Would be cool if you could review in the new year.

Examples:


# --- Create a profile
New-vRAConnectionProfile -Name "dev-lab" -Tenant "tenant01" -Server "server.vra.local" -Username "user01" -IgnoreCertRequirements -SslProtocol

# --- Retrieve a Profile
Get-vRAConnectionProfile -Name "dev-lab"

# --- Update a Profile
Set-vRAConnectionProfile -Name "dev-lab" -Tenant "Tenant02"

# --- Connect to vRA
Connect-vRAServer -ProfileName "dev-lab"

# --- Remove a Profile
Remove-vRAConnectionProfile -Name "dev-lab"

Notes

  1. Profiles do not store your password. You will be prompted to enter it when using Connect-vRAServer
  2. Get-vRAConnectionProfile's Name param & Connect-vRAServer's ProfileName param use dynamic parameters and support tab completion
  3. Tested on Core & Windows

Running locally

Run the following to use locally:

.\tools\build.ps1
Remove-Module -Name PowervRA -Force
Import-Module .\Release\PowervRA\PowervRA.psd1 -Force
jonathanmedd commented 6 years ago

@chelnak Very nice - I like it a lot!

A couple of things:

1) Is it possible to give it Credential object support for Connect-vRAServer ? - maybe be able to supply the name of a Credential variable to use (of course this would have to be made in the PS session before it could be used via the profile.) 2) There was a minor typo in a comment in Connect-vRAServer line 117 - I've corrected it for you