Skip to content

manually specify powershell version (e.g. 7) #371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
OneCyrus opened this issue Dec 17, 2019 · 20 comments
Closed

manually specify powershell version (e.g. 7) #371

OneCyrus opened this issue Dec 17, 2019 · 20 comments
Milestone

Comments

@OneCyrus
Copy link

is there a way to change the used powershell version? would like to give powershell 7 rc1 a try as we have some code which doesn't work with PS6.

@JustinGrote
Copy link

The azure functions core tools (the one you run locally) might be able to do it but you'd have to modify the source code, there's no built in option.

No roadmap's been published yet for upgrading the worker to 7, I imagine that will coincide with the upgrade from functions runtime v2 to v3.

@AnatoliB
Copy link
Contributor

We will allow switching to PS7 soon after PS7 goes GA.

Right now, the only way to use PS7 in Functions is to package/deploy the PS7 files together with your app and invoke pwsh.exe from your Function code (which I would recommend only if you have a very strong reason).

By the way, Functions runtime v3 is currently released, and it also uses PS6.

@mhoeger mhoeger added this to the Backlog milestone Jan 1, 2020
@dpolivy
Copy link

dpolivy commented Mar 13, 2020

@AnatoliB Now that PS7 is GA, any timeline for being able to use this with Azure Functions v3 runtime? I see the code appears to be committed to the repo, but not sure how to use it either locally or in Azure Functions without building myself?

@AnatoliB
Copy link
Contributor

@dpolivy Right now, building the worker from the dev branch is the only way. Expect PS7 to be available on Azure between the end of March and the middle of April. I will be updating this thread with more precise ETA and status as soon as I have them.

@JustinGrote
Copy link

@dpolivy you can also download the built nupkg from Appveyor, rename it to .zip, and then extract it from there
https://ci.appveyor.com/project/appsvc/azure-functions-powershell-worker/builds/31432379/job/0bend5twai5dkg3e/artifacts
image

Extract it to your workers directory for core tools per the readme. I installed azure-functions-core-tools using http://scoop.sh so mine is at
C:\Users\jgrote\scoop\apps\azure-functions-core-tools\current\workers

@AnatoliB
Copy link
Contributor

@dpolivy @JustinGrote Thank you, Justin. If you do this, you also need to set the following variable before starting the function host locally:

$env:FUNCTIONS_WORKER_RUNTIME_VERSION = '~7'

You will not have to do this when we release PS7 support officially.

@JustinGrote
Copy link

JustinGrote commented Apr 16, 2020

@AnatoliB we are now at mid-april, can you provide a revised ETA? :)

@AnatoliB
Copy link
Contributor

@AnatoliB we are now at mid-april, can you provide a revised ETA? :)

The situation is currently complicated by certain events beyond our control. The coding work is finished, but the deployment to Azure will probably happen around the middle of May. I'm sorry I don't have a more precise and reliable ETA, but this is the best I can do at this point. Thank you for your patience!

@JustinGrote
Copy link

@AnatoliB Understood! Thank you for all your hard work and I appreciate the update, it just helps to know how far out I should be looking at refactoring.

@akhilthomas011
Copy link

@AnatoliB Is this in production now? Can you help me with the status?

@AnatoliB
Copy link
Contributor

The Functions runtime with PowerShell 7 is being rolled out to production now, I expect it to complete by June 5. I will update this thread when complete.

@akhilthomas011
Copy link

@AnatoliB, Really appreciate it! Thanks!

@JustinGrote
Copy link

@AnatoliB FYI I saw this today I've never seen before, may be related to rollout:
https://twitter.com/JustinWGrote/status/1266033654016311296

@wsf11
Copy link

wsf11 commented Jun 8, 2020

Hi @AnatoliB , any update on when this will be in production? Thanks for working on this!

@AnatoliB
Copy link
Contributor

AnatoliB commented Jun 9, 2020

The runtime rollout is almost finished and PowerShell 7 is available in many regions now, expected to finish the rest tomorrow (6/9).

Portal and tools support will take a bit longer. In the meantime, in order to upgrade your app to PowerShell 7, set the powerShellVersion property on the /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{appName}/config/web resource to ~7. You can do it with the following command:

$SubId = ...
$ResourceGroupName = ...
$AppName = ...
Set-AzResource -ResourceId "/subscriptions/$SubId/resourceGroups/$ResourceGroupName/providers/Microsoft.Web/sites/$AppName/config/web" -UsePatchSemantics -Properties @{ powerShellVersion = '~7' } -Force

Any other way of updating ARM resources (Resource Explorer, ARM templates, etc.) should also work. Set the property to ~6 to revert the app back to PowerShell 6, if required.

You may need to restart the app after this.

A temporary caveat: this property is currently write-only. You can set it, but GET will return null, regardless of the actually persisted value. This bug will be fixed soon. This problem does not affect the language version used for executing functions.

@JustinGrote
Copy link

@AnatoliB great news, can you have them make a post on the Functions Blog about it when it's fully rolled out?

@AnatoliB
Copy link
Contributor

AnatoliB commented Jun 9, 2020

@JustinGrote We will announce this officially only after the Portal and tools support catch up. Until then, I will just leave these instructions here.

@AnatoliB
Copy link
Contributor

The rollout is complete now, PowerShell 7 is available in all the public regions. I'm closing this issue, but I will be updating it with the tools and portal status. In the meantime, please use the instructions above, and we will appreciate your feedback.

@AnatoliB
Copy link
Contributor

The rough ETA for official GA (including portal and tools support) is the beginning of July.

@AnatoliB
Copy link
Contributor

Officially GA now: https://azure.microsoft.com/updates/azure-functions-powershell-7-support-is-now-generally-available

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants