PowerShell SAM Error not recognized as the name of a cmdlet, function, script file, or operable program.

Hi,

I am working on a SAM Template to run the below piece of code. It is using a 3rd party cmdlet. I can run the script from the Orion Server without any issues.

$psw=ConvertTo-SecureString "TEST" -AsPlainText -Force
Connect-Pfa2Array -Endpoint 20.20.10.10 -Username user -Password $psw -IgnoreCertificateError
$Storage = Pfa2Hardware | Select Name, Serial, Status, Type | Where-Object {($_.Type -eq "drive_bay")} | ConvertTo-Html
write-host "\nMessage: $Storage";
write-host "\nStatistic: 0";

When I try to run from the SAM Component Monitor, I get the below error. Any one has faced a similar issue and how it was fixed?

Connect-Pfa2Array : The term 'Connect-Pfa2Array' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:2 char:1
+ Connect-Pfa2Array -Endpoint 20.20.10.10 -Username pureapiuser -Passw ...
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Connect-Pfa2Array:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Pfa2Hardware : The term 'Pfa2Hardware' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:3 char:12
+ $Storage = Pfa2Hardware | Select Name, Serial, Status, Type | Where-O ...
+ ~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Pfa2Hardware:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException