PowerShell 7.2 Support to Scripted Action Azure Runbooks

The Scripted Actions runbook process appears to be hard coded to use PowerShell 5.1, and in a recent script I had relied on a function only available in PowerShell 6 or later. So, this led to needing to re-architect. It would seem to me an appropriate time to add an opt-in to make all Scripted Actions use PowerShell 7.2 (the current GA version of PowerShell 7) at the account and/or MSP level or to allow an individual scripted action to be import as a 5.1 or 7.2 version, thus making two side-by-side instances. 

There may be Nerdio scripted actions that would need to be modernized to support 7.2 in order to make all scripted actions 7.2, but that would seem to be appropriate. Most Azure stuff which is what Nerdio works with is fully supported in 7.2 anyway. Giving customers the choice would likely work out.

0

Comments (4 comments)

Avatar
Dave Stephenson

Great call-out, Jacob Reinhardt!
I'm noticing a similar trend with Microsoft where newer PowerShell Modules are only available with "modern" versions of PowerShell.
Like you mentioned, quite a bit will need to be converted/updated to the latest GA version of PowerShell. However, it will take a lot of coordination/testing to make sure the existing solutions are backward and forward compatible (as much as possible). Maybe we can create a separate repository for "modern PowerShell" and as the scripts are updated, they can be moved there? 🤔

Out of curiosity, what were you trying to do that requires PowerShell 6+?
If it's proprietary, don't feel like you need to share it. I'm just curious. 🤓

0
Avatar
Chris Brannon

Dave Stephenson With Azure Automation moving to Runtime Environments, what about the ability to manage those REs within NMM and choose which RE is used for the scripted action? This would allow us to test/use different PowerShell versions and modules. That would be a slick solution and extremely helpful with many of the automations we are building out.

2
Avatar
Jacob Reinhardt

Thank you Dave. Chris Brannon does mention an important point which I would concur with. He is aware more than I am I think of the particulars but change is indeed coming.

The idea he gives would have applicability to modules too. I would prefer to have control within Nerdio about modules, so that a later update won't remove changes I make in the automation account. For now, I have written in manually installing my modules (i.e. Microsoft.Graph versions) in the scripted action itself.

As to what required PowerShell 7, it has focused on missing features on basic cmdlets. In this case, it was the -AsHashTable switch on ConvertFrom-Json. That was added in PowerShell Core, so I couldn't use it in my Scripted action. I had to use a .NET class that would accomplish the same thing. It was not as easy to do but acceptable. Thank you!

0
Avatar
Dave Stephenson

THIS is why I Love coming to the Nerdio Forums! 
We all have a common (or similar) problem and get collaboration from the community to come-up with something really cool.
Thanks, Chris Brannon and Jacob Reinhardt!

Adding the ability to do Runtime Environments will provide the ability to choose the best tool for the job.
My only concern would be on the introduction of Python into NMM. It could be the best new tool for NMM reporting or just a bad idea/all-out war. 🤔
We could probably have the team start with the PowerShell options and then tackle Python REs if there's enough of a demand for it.

0

Please sign in to leave a comment.