azureautomation / azure-automation-ise-addon

The Azure Automation PowerShell ISE Add-On makes it easy to author and test your runbooks in your local PowerShell ISE
https://www.powershellgallery.com/packages/AzureAutomationAuthoringToolkit/
Other
122 stars 24 forks source link

Issue with Get-AutomationPSCredential when installed on an Azure Automation Hybrid Worker #134

Closed michaeljprentice closed 7 years ago

michaeljprentice commented 7 years ago

The error returned, if an Asset isn't downloaded to the server while the addon is installed;

:[localhost]:AzureAutomationAuthoringToolkit: Warning - Local value for PSCredential asset "onpremexcCred" not found

Fix is to uninstall the Addon from the Hybrid Worker. Thanks to sn0m55 for pointing it out

https://social.msdn.microsoft.com/Forums/en-US/ac204c88-7f95-48b6-8ab6-656253735aa2/getautomationpscredential-hybrid-worker?forum=azureautomation

eamonoreilly commented 7 years ago

Hi Michael, The toolkit emulates the internal activities (like Get-AutomationPSCredential) so that runbooks can be authored and tested locally. Since these activities are also used by the hybrid worker when running runbooks from the service, they conflict, as you have seen above. The solution to this is to not put the toolkit into the program files\windowspowershell\modules which unfortunately the default when installing from the PowerShell gallery. Instead if you install it into your own scope by using Install-Module AzureAutomationAuthoringToolkit -Scope CurrentUser then the hybrid worker will not find these emulated activities and instead use the ones required for it to work correctly. Hopefully this helps you getting the add-on going again and please let me know if this does not solve your issue. Sorry you hit this, Eamon

eamonoreilly commented 7 years ago

Closing issue since the workaround should help here and I also updated the PowerShellGallery download page to let customers know they should use the -Scope CurrentUser when installing the add-on. Thanks for the feedback, Eamon

Ashish-Jovial commented 4 years ago

Hi Michael, The toolkit emulates the internal activities (like Get-AutomationPSCredential) so that runbooks can be authored and tested locally. Since these activities are also used by the hybrid worker when running runbooks from the service, they conflict, as you have seen above. The solution to this is to not put the toolkit into the program files\windowspowershell\modules which unfortunately the default when installing from the PowerShell gallery. Instead if you install it into your own scope by using Install-Module AzureAutomationAuthoringToolkit -Scope CurrentUser then the hybrid worker will not find these emulated activities and instead use the ones required for it to work correctly. Hopefully this helps you getting the add-on going again and please let me know if this does not solve your issue. Sorry you hit this, Eamon

I tried this but didn't work for me.

eamonoreilly commented 4 years ago

Can you run 'Get-Module -ListAvailable | where {$_.Name -match 'AzureAutomationAuthoringToolkit'} | Format-List' and make sure that the module is only installed in the current user directory. You will need to open up a new PowerShell ISE session to make sure that existing modules are unloaded also if you already had it installed. Thanks, Eamon