Part3 : How to use PowervRACloud with ABX Powershell Actions as Zip Package

 In the Part3, of the 3 blog series, I will show how to create a Zip package for ABX action which will include the PowervRACloud module. This will be helpful if you have an Airgap environment that doesn\’t have direct access to Powershell Gallery to download the PowervRACloud module. 

Pictures

 

If you haven\’t checked 

  • Part1 where I shared the procedure on how to write Extensibility Action Script with Event Subscriptions. You can Click Here
  • Part2 where I shared the procedure on how to write Extensbitlity Action Script and use it as Service Broker Catalog Item. You can Click Here

Quick Recap of What is vRA ABX and PowervRACloud

What is vRA ABX?

vRealize Automation Action Based Extensibility (ABX) supports Powershell as one the scripting language for writing ABX actions.  ABX actions are small, lightweight scripts of code used to specify an action and how that action is to perform

What is PowervRACloud ?

PowervRACloud is a PowerShell module that abstracts the VMware vRealize Automation Cloud APIs to a set of easily used PowerShell functions.

Procedure to create Zip Package for ABX Action 

The following steps describe the procedure to create your script on your local environment along with the PowervRACloud module and create a Zip package.  You can refer to official vRA documentation for more details 

Step 1 – Login to any Linux VM which has Powershell installed and it has access to Powershell Gallery 

Step 2 – Create a folder for your action script and dependencies.

mkdir abx-powervracloud
cd abx-powervracloud
mkdir Modules

Step 3 – Install PowervRACloud module from PSGallery Repository

https://www.powershellgallery.com/packages/PowervRACloud/1.4

pwsh -c \"Save-Module -Name PowervRACloud -Path ./Modules/ -Repository PSGallery\"  

 

 

 

Step 4 – Create PowerShell script with psm1 extension 

 

 

 

 

 

https://vcommunique.blogspot.com/2021/02/part2-how-to-use-powervracloud-with-abx.html

Here I am only going to create show the script which I create to Generate Deployments Report in Part2 of the blog series. You can create the refer my Part 1 to get the script for Creating Snapshot. 

Step 5 – Create a zip package 

zip -r --exclude=*.zip -X PowervRACloud-vRA-Deployments-Report.zip .

 

 

 

 

 

Step 6 – Copy to a machine from where you can import it using Webbrowser.

 

Importing ABX Action package. 

Navigate to  Extensibility > Library > Actions & Click New Action. 

Enter a name for your action and select a project.

 

 

 

 

 

 

 

 

Select the Powershell as the action runtime

Select Import-Package

 

 

 

 

 

We will specify the following

Main function

handler.handler

Inputs

server - vRA Server
Username - Username for vRA Server
Password - Password for vRA Server
toaddress - Specify Email of the recipient 
fromaddress - Specify the Senders Email 
emailserver - Email Server which should be reachable from vRA 

FaaS provider

With PowerShell, FaaS provider will always be On-prem. 

 

 

 

 

You can validate by clicking Test 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

If the test is successful you should see the HTML report in your Inbox 

 

 

 

 

 

You can now publish it as Catalog Item and I showed in Part2.

 

 

 

 

 

 

 

 

 

 

 

 

Conclusion

As you can see how easily PowervRACloud can integrate with ABX to extend vRA functionalities.  

Thank you for using PowervRACloud. Please reach out on Twitter if there are any queries  

 

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: