How to update the PowerShell version in Azure App service WebJobs where the WebApp is a ASP.NET format ?

sidh c 25 Reputation points
2023-08-22T07:12:35.4+00:00

I have a App Service which is a ASP.NET app and there is a Web Job which has a PowerShell script. Due to the lower version(5.1) configured default in the Web Jobs environment, The script is getting failed. So is there a way to update the PowerShell to the latest version.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,652 questions
0 comments No comments
{count} votes

Accepted answer
  1. brtrach-MSFT 16,121 Reputation points Microsoft Employee
    2023-09-01T01:26:58.8233333+00:00

    @sidh c It sounds like you are installing the packages in the Kudu environment CMD, which is not a persistent environment. When you restart the App Service, the Kudu environment is also restarted, which means any changes made to it are lost.

    To ensure that the packages are installed persistently, you can include the package installation commands in your Python script itself. This way, the packages will be installed every time the script is run, regardless of whether the App Service has been restarted or not.

    Alternatively, you can create a requirements.txt file that lists all the required packages and their versions and upload it to your App Service. This file can be used to install the packages automatically whenever the App Service is restarted. You can refer to the Azure documentation on how to use requirements.txt file to install packages in App Service.

    Regarding the survey that you submitted, we remind you that the survey is for the support provided on the forum and not regarding the product. As engineers we are held to these surveys so, please let me know if there is anything else that I can do to make you happy regarding the support provided on the forum. If you are now satisfied with your experience, please consider accepting this answer or feel free to take a new survey.

    Thank you for your understanding.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. brtrach-MSFT 16,121 Reputation points Microsoft Employee
    2023-08-22T23:19:07.1133333+00:00

    @sidh c It is not possible to configure the PowerShell version of an Azure Web App.

    Web Jobs are meant for a quick and easy way to deploy scripts. For customers with more specific requirements, the recommendation is to use an Azure Function app, which supports more recent versions of PowerShell, including 7.X.

    We will mark your thread as feedback for the product group though and bring this up to the product group. We have a meeting with them in 3 weeks.

    For the most part though, customers are advised to pursue Azure Functions as it offers all of the same features and functionality of Web Jobs and receives regular updates. Thank you for your understanding on this matter.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.