In the previous blog post, we explored the Application Transformer for VMware Tanzu REST API and how it can be used for automation and more advanced workflows. To simplify the consumption of the App Transformer REST API and how I started to explore and learn about the APIs, I created a PowerShell module for App Transformer that implements a number of the App Transformer REST API that can easily be consumed using the following functions:
🥳 To help celebrate the official GA of Application Transformer for VMware Tanzu today, I have just published my PowerShell Community Module for App Transformer into the PowerShell Gallery!
The App Transformer Community PowerShell module can be installed directly from the PowerShell gallery with the following command:
Before you can use any of the App Transformer functions, you will need to first login using Connect-AppTransformer function which accepts FQDN/IP Address of your App Transformer instance and the username and password as demonstrated in the example below.
$AppTransformerUsername = "FILL_ME_IN" $AppTransformerPassword = "FILL_ME_IN" [Security.SecureString]$SecurePassword = ConvertTo-SecureString $AppTransformerPassword -AsPlainText Connect-AppTransformer -Server at.vmware.corp -Username $AppTransformerUsername -Password $SecurePassword
Before you can register a vCenter Server or perform an introspection operation against your VMs, you will first need to create a few credentials by using the New-AppTransformerCredential function which accepts credential alias (short name), username and password demonstrated in the example below.
$vmcVCUserAlias = "*protected email*" $vmcVCUsername = "*protected email*" $vmcVCPassword = "FILL_ME_IN" [Security.SecureString]$SecurePassword1 = ConvertTo-SecureString $vmcVCPassword -AsPlainText New-AppTransformerCredential -Alias $vmcVCUserAlias -Username $vmcVCUsername -Password $SecurePassword1
We can also retrieve existing credentials by using the New-AppTransformerCredential as shown in screenshot below. The function also supports filtering by credential alias name if you specify the -Name parameter. If you need to remove a credential, you can use Remove-AppTransformerCredential function which accepts the credential alias name.
Below is an example of adding several different credentials which will then be referenced in other functions.
Once you have added the credentials for your desired vCenter Server, we can now register it by using the New-AppTransformerVCenter function which accepts the FQDN/IP Address of the vCenter Server, alias name for vCenter Server and the credential alias name as demonstrated in example below.
We can list our registered vCenter Server by using the Get-AppTransformerVCenter function as show in example below.
vRealize Network Insight Cloud
Once a vCenter Server has been registred with App Transformer, you can then register the respective vRealize Network Insight or vRealize Network Insight Cloud (vRNIC) instance, if you have that deployed. The module currently only includes support for registering vRNIC instance using the New-AppTransformerNetworkInsightCloud function which accepts CSP token with a minimum of the Network Insight User role and the vCenter Server alias name that vRNIC instance is registred with as demonstrated in the example below.
We can list our registered vCenter Server by using the Get-AppTransformerNetworkInsightCloud function as show in the screenshot below.
Once you have successfully registred your vCenter Server, you can perform a "shallow" scan where App Transformer will see the list of available VMs that can then be introspected (once guest credentials have been associated) and also go through topology discovery (assuming you have vRNIC deployed and running). To see the list of all VMs, you can use the Get-AppTransformerVM function and you can also filter by specifying the -Name parameter.
Assuming you have already created or bulk import guestOS credentials, we now need to associate the specific credentials with the respective VM(s). To do this, you can use the New-AppTransformerCredentialAssociation function which accepts credential alias name and list of VM(s) to be associated with that credential. Below is an example associating two different credentials with a list of VM(s), which becomes extremely useful for large environments.
$SimpleVMCredentialName = "root-simple" $SimpleVMs = ("tomcat-vm","tomcat_centos7") $ComplexVMCredentialName = "root-complex" $ComplexVMs = ("JBoss-VM","MySql-DB","Tomcat-multi-instance","Weblogic-12C","websphere_centos7","app_db_vm","web_db_vm") New-AppTransformerCredentialAssocation -CredentialName $SimpleVMCredentialName -VMNames $SimpleVMs New-AppTransformerCredentialAssocation -CredentialName $ComplexVMCredentialName -VMNames $ComplexVMs
Note: To determine if a VM has been associated with a credential, you can use the Get-AppTransformerVM function to check serviceAccount property.
Once a credential has been associated with a VM, we can now perform the Introspection operation by using the Start-AppTransformerIntrospection function which accepts the name of a VM to start the Component discovery.
Below is an example looping through our $SimpleVMs and $ComplexVMs list and performing the Introspection. A sleep is added as App Transformer will not process further Introspection if there are too many running, so you may want to batch the operation based on the size of your environment.
To list all Components discovered by App Transformer, you can use the Get-AppTransformerComponent function, which also supports filtering based on the name of a Component by using the -Name parameter as demonstrated below.
Note: The underlining App Transformer REST API for retrieving Components supports a number of advanced filtering options, the function provided here is only a sample implementation and for more advanced options, you should consider enhancing the function based on your requirements.
To list all Applications discovered by App Transformer or that has been manually created, you can use the Get-AppTransformerApplication function, which also supports filtering based on the name of a Component by using the -Name parameter as demonstrated below. For automatic Application discovery, you will need data from vRealize Network Insight or vRealize Network Insight Cloud and run the topology discovery operation prior to listing the Applications.
Note: The underlining App Transformer REST API for retrieving Applications supports a number of advanced filtering options, the function provided here is only a sample implementation and for more advanced options, you should consider enhancing the function based on your requirements.
App Transformer includes over 200+ out of the box component signatures and you can certainly add custom signatures to teach App Transformer about new or custom applications you have running in your environment. You can view all signatures by using the Get-AppTransformerComponentSignature function, which also supports filtering based on the name of a Component by using the -Name parameter as demonstrated below.