microsoft / SQLServerPSModule

This repo is the home of SQL Server PowerShell Module development.
MIT License
45 stars 1 forks source link

Adding module to azure automation runtime 7.2 fails with This module requires PowerShell 7.2.1+. Please, upgrade your PowerShell version by checking https://aka.ms/pscore6. #72

Closed craftzneko closed 4 hours ago

craftzneko commented 5 months ago

Does this mean it wont run until azure automation is also updated and if so can we install prior versions of the module, otherwise i am going to have to go back to a runtime of 5 which seem silly

Matteo-T commented 5 months ago

Hi @craftzneko, what does the Azure Automation folk say? 7.2 is is kind of ancient in a world that moves pretty fast...

If they are not planning on moving forward and there are no other ways to use a better version of PowerShell for your workload, I can probably look into chaning that to 7.2.... It's been a while, but I don't think there was a super-specific reason to pick 7.2.1... it was just what I was using to test back then.

@SteveL-MSFT - out of curiosity, is PS7.2 still "supported"? I would naively think that with 7.4+ being out, 7.2 is ancient history so maybe the Azure Automation folks should consider updating their stuff? Do you have a contact for them?

djturner commented 5 months ago

I am also running into this issue. The module works fine in Azure Automation when installed against the 5.1 runtime, does not work when installed against the 7.2 runtime. Current workaround seems to be to use the 5.1 runtime if you need to use this module with Azure Automation.

jonasaebersold commented 5 months ago

Hi @Matteo-T

Powershell 7.2 was just "Preview" for over an year and is now "Recommended" since November 2023.

https://azure.microsoft.com/en-us/updates/azure-automation-powershell7-python3/ https://azure.microsoft.com/en-us/updates/azure-automation-powershell7-2-general-availability/

I avoid preview features in Azure and wait till the feature is GA. Version 7.2 is GA for 3 months, so I don't think, they will release 7.3 or 7.4 soon. Powershell 7.2 is supported till November 2024, so it would be great, if you could change the check to 7.2. For me and probably the others, 7.2 would be better than staying on 5.1

https://learn.microsoft.com/en-us/powershell/scripting/install/powershell-support-lifecycle#powershell-end-of-support-dates

Thanks

craftzneko commented 4 months ago

Hi @Matteo-T as @jonasaebersold commented we pretty much feel the same, these are production systems and stability over bleeding edge is preferred. Is it possible to change to install on 7.2 or are there breaking reasons why this won't work on 7.2? I would prefer to run 7.2 over 5 but if not possible it will do for now

jonasaebersold commented 4 months ago

Hi. I don't want to be the "any updates on this"-guy, but it's really blocking us on our migration to Powershell 7.2 in Azure Automation. @Matteo-T In your comment it sounded like it should be a small change - is the change bigger than excepted or do you have no time/energy for a test? I don't know the reason, and there are bigger problems in this world than a waiting Azure Automations update - but it would be great, if you could send us a small update. Thanks

somesh-bhalerao commented 2 months ago

User Framework 7.2 and instead of SqlServer module use Invoke-SqlCmd2

It solves my issue, as I do not need to use framework 5.1, by using framework 7.2, I can also use PnP-Powershell SharePoint Online commands as well.

I hope SqlServer module will be more mature in coming days.

$databaseUser = "SQLUserName"
$databasePwd = "SQLUserPassword"
$SQL="select * from TempTable"
[SecureString]$SecurePass = ConvertTo-SecureString $databasePwd -AsPlainText -Force
[System.Management.Automation.PSCredential]$Cred = New-Object System.Management.Automation.PSCredential($databaseUser, $SecurePass) 
$ReSQL=Invoke-SqlCmd2 -Query $SQL -ServerInstance $databaseServer -Database $databaseName -Credential $Cred
$ReSQL.Count
Matteo-T commented 3 weeks ago

I do not know exactly how soon the Azure Automation folks are going to jump to PS 7.4+, so in the interim I'm just downgrading the min required version of PS7 to 7.2.0 - to unblock this scenario.

I expect to have this out in v22.3.

Matteo-T commented 4 hours ago

Could you guys try v22.3.0? I lifted the restriction on 7.2.1, so 7.2.0 (which is both ancient and likely vulnerable... on my machines Windows or my IT folksl take care of bumping it to 7.2.19 after a few minutes), so thing should be better now.