azure-pipelines-tasks: ##WARNING##:PowerShell Core (pwsh.exe) is not available on agent machine. Falling back to using Windows PowerShell (powershell.exe). This can cause reduced performance

I have a pipeline with that i call the “IIS web app deploy” task twice.

the first i got error, but the last, its ok.

the first log

2021-03-16T14:45:15.8461138Z ==============================================================================
2021-03-16T14:45:15.8461433Z Task         : IIS web app deploy
2021-03-16T14:45:15.8461693Z Description  : Deploy a website or web application using Web Deploy
2021-03-16T14:45:15.8461944Z Version      : 0.184.0
2021-03-16T14:45:15.8462138Z Author       : Microsoft Corporation
2021-03-16T14:45:15.8462483Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/iis-web-app-deployment-on-machine-group
2021-03-16T14:45:15.8462889Z ==============================================================================
2021-03-16T14:45:16.6126018Z ##WARNING##:PowerShell Core (pwsh.exe) is not available on agent machine. Falling back to using Windows PowerShell (powershell.exe). This can cause reduced performance. Please install the newer version of PowerShell for improved performance.
2021-03-16T14:45:16.6165708Z [command]C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -NoProfile -NonInteractive -Command "Expand-Archive -Path \"C:\azagent\A2\_work\r1\a\IMPLANTANET\Common\Implanta.Common.Web.CDN.zip\" -DestinationPath \"C:\azagent\A2\_work\_temp\temp_web_package_11780163432773327\" -Force"
2021-03-16T14:45:34.3159510Z Remove-Item : Cannot find path 'C:\azagent\A2\_work\_temp\temp_web_package_11780163432773327\Content\D_C\a\1\s\src\Comm
2021-03-16T14:45:34.3160324Z on\Implanta.Common.Web.CDN\obj\Release\Package\PackageTmp\BarCodeHandler.ashx' because it does not exist.
2021-03-16T14:45:34.3169917Z At 
2021-03-16T14:45:34.3170466Z C:\windows\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Archive\Microsoft.PowerShell.Archive.psm1:411 
2021-03-16T14:45:34.3171025Z char:46
2021-03-16T14:45:34.3171407Z + ...                 $expandedItems | % { Remove-Item $_ -Force -Recurse }
2021-03-16T14:45:34.3171875Z +                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-03-16T14:45:34.3172488Z     + CategoryInfo          : ObjectNotFound: (C:\azagent\A2\_...odeHandler.ashx:String) [Remove-Item], ItemNotFoundEx 
2021-03-16T14:45:34.3172936Z    ception
2021-03-16T14:45:34.3173273Z     + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
2021-03-16T14:45:34.3173584Z  
2021-03-16T14:45:34.3196734Z Remove-Item : Cannot find path 'C:\azagent\A2\_work\_temp\temp_web_package_11780163432773327\Content\D_C\a\1\s\src\Comm
2021-03-16T14:45:34.3197465Z on\Implanta.Common.Web.CDN\obj\Release\Package\PackageTmp\bin\' because it does not exist.

but in the same pipeline, the next task, runs ok.

the second log

2021-03-16T14:46:13.4512632Z ##[section]Starting: Deploy IIS Website/App: CRM
2021-03-16T14:46:13.4593875Z ==============================================================================
2021-03-16T14:46:13.4594171Z Task         : IIS web app deploy
2021-03-16T14:46:13.4594441Z Description  : Deploy a website or web application using Web Deploy
2021-03-16T14:46:13.4594682Z Version      : 0.184.0
2021-03-16T14:46:13.4594888Z Author       : Microsoft Corporation
2021-03-16T14:46:13.4595225Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/iis-web-app-deployment-on-machine-group
2021-03-16T14:46:13.4595626Z ==============================================================================
2021-03-16T14:46:17.9437651Z ##[warning]Unable to apply transformation for the given package. Verify the following.
2021-03-16T14:46:17.9439940Z ##[warning]1. Whether the Transformation is already applied for the MSBuild generated package during build. If yes, remove the <DependentUpon> tag for each config in the csproj file and rebuild. 
2021-03-16T14:46:17.9441945Z ##[warning]2. Ensure that the config file and transformation files are present in the same folder inside the package.
2021-03-16T14:46:18.0400057Z Initiated variable substitution in config file : C:\azagent\A2\_work\_temp\temp_web_package_04240053675901212\web.config
2021-03-16T14:46:18.0450274Z Skipped Updating file: C:\azagent\A2\_work\_temp\temp_web_package_04240053675901212\web.config
2021-03-16T14:46:18.0450803Z XML variable substitution applied successfully.
2021-03-16T14:46:18.0906546Z [command]"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:IisApp='C:\azagent\A2\_work\_temp\temp_web_package_04240053675901212' -dest:iisApp='daf-07.implantadev.net.br/crm' -skip:Directory=App_Data -skip:Directory=^api$
2021-03-16T14:46:18.4921467Z Info: Object dirPath (daf-07.implantadev.net.br/crm\api) skipped due to skip directive 'CommandLineSkipDirective 2'.
2021-03-16T14:46:18.5072541Z Info: Adding file (daf-07.implantadev.net.br/crm\1-es2015.e18d59dcb22750d8ccff.js).
2021-03-16T14:46:18.5134447Z Info: Adding file (daf-07.implantadev.net.br/crm\1-es5.e18d59dcb22750d8ccff.js).
2021-03-16T14:46:18.5139507Z Info: Adding file (daf-07.implantadev.net.br/crm\10-es2015.5b40fe0727b1a8ff0c42.js).
2021-03-16T14:46:18.5146813Z Info: Adding file (daf-07.implantadev.net.br/crm\10-es5.5b40fe0727b1a8ff0c42.js).
2021-03-16T14:46:18.5154719Z Info: Adding file (daf-07.implantadev.net.br/crm\11-es2015.8c7132ed62bcc7eed110.js).
2021-03-16T14:46:18.5163928Z Info: Adding file (daf-07.implantadev.net.br/crm\11-es5.8c7132ed62bcc7eed110.js).

Required Information

Enter Task Name: IIS web app deploy

Environment

  • Server - Azure Pipelines runing o VM o Azure

Accountname:https://dev.azure.com/implantainformatica/ ProjectName:IMPLANTANET Release definition name:DAF Link: https://dev.azure.com/implantainformatica/IMPLANTANET/_releaseProgress?releaseId=40568&_a=release-environment-deployment-group-logs&environmentId=880539&deploymentGroupPhaseId=106117&agentName=DEV-DAF-1

  • Agent : Private:
    • OS: Windows
    • Agent version :2.181.1

Issue Description

the first return warning, and due to the alert (I believe) the copy of the files fails, you cannot extract the files correctly from the “zip”.

When this error occurs, the target folder (iis application) looks like that:

image but with all folders without files

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 32 (6 by maintainers)

Most upvoted comments

After reading the commit referenced above, it seems the developers left a switch to force the IIS Web App Deploy task back to using 7zip for artifact extraction. Just add a pipeline variable “ADO_FORCE_USE_7ZIP” set to “true”.

This is a terrible way to introduce a breaking change. The version number of the Task should have been increased so we could at least choose the old behavior. We spent 2 hours last night trying to figure out why all our release pipelines started failing before finally finding the obscure ADO_FORCE_USE_7ZIP setting.

The logic to detect whether to use PowerShell or 7Zip should at least check to see whether Expand-Archive exists in PowerShell and revert to 7Zip if not. If that’s not possible we at least need a way to change the setting more easily.

I’ll also note that our servers are Azure-hosted windows server instances that were created as recently as December, and they don’t have the requisite version of Powershell to run this task. Seems like this change could easily cause problems for far more users than for whom it fixes the issue with UTF8 characters in filenames.

I can verify that the pipeline variable solved the same issue for us; however, we are running many locally hosted agents that will need powershell approved/installed, or we have many release pipelines that will need an edit. Will there be a fix for this issue so this isn’t work we have to do, or is it a permanent (breaking) change? CI/CD is broken for us at the moment.

Sorry for the inconvenience caused. We are working on fix which will solve both the issues 1) defaulting to existing 7 zip tooling and 2) Handling the special characters with msbuild packages. Only customers who are facing issues with special character in msbuild need to update their pipelines and add a special variable “ADO_FORCE_USE_PSUNZIP” with value ‘true’, other customer does not need to update their pipeline, their scenario should work fine as it was working till last week. Even for customer who has added pipeline variable “ADO_FORCE_USE_7ZIP” or installed PS core, there should not be any change required, their scenario will continue to work without any pipeline / task update. We are already in process of rolling out the new fix with 0.184.1 version of task. It will reach to all customer within next three days. Thank you for support

Looking at #14626 is still appears that they are going to force/require that we add a pipeline variable: ADO_FORCE_USE_PSUNZIP in order for the current IIS Web App Deploy step to work properly…Complete hack IMO. Its going to require Admins to update every pipeline currently that currently uses the IIS Web App Deploy action.

Also, It appears the PR was merged into master. Can an Op please respond with an ETA, when this hack will be in Production?

FWIW I read that PR differently; I think all your pipelines that do not declare any hacky variables will work as they did before. Only if a pipeline is run with ADO_FORCE_USE_PSUNZIP=true will the extraction task use PowerShell, otherwise it’ll use 7zip as it did before the breaking change. Users who are experiencing the original issue Azure devs tried to fix (UTF characters in filenames) will need to add that variable to their pipelines in order for them to use PowerShell Expand-Archive. Hoping I’m right here.

I do like how the status of this ticket is clearly being updated but no one’s bothered to answer any of the questions yet.

Surely this isn’t complex to fix? Either roll back the change or issue some workaround guidance or do a patch to have it default back to 7zip if Powershell Core isn’t installed.

This also broke all of our release pipelines and has delayed a production release. Are you really not going to roll back this change? Installing the powershell core requires taking production machines offline and scheduling a maintenance window (causing further delays).

I would simply like a answer as to whether or not this is going to be fixed so the the IIS Web App Deploy activity functions properly as it did before?

I have the same situation as ebcdavid- CI/CD is broken at the moment. Applying this workaround all over Devops is not a pleasant experience. Is there a timeline for a solution?

The thing that the developer called “experimental” in the PR is now the official accepted way to back out the breaking change to this task. Good times.

Also, do these tasks not have incrementable version numbers? Azure tells me that the IIS Web App Deploy task is version 0, with no other versions available. If this change doesn’t warrant a version bump, retaining the old version that doesn’t use Expand-Archive, I’m not sure what does.

This change to use Expand-Archive instead of 7zip broke the IIS web app deploy task on all my servers. Please fix or revert it.

The deployment of 0.184.1 has been completed, as stated with previous comment, existing pipeline should work as expected and defaulted to use 7 zip

Official responses notwithstanding, there appears to be a PR to back this out by reversing the sense of the change - keeping PowerShell as a method of archive extraction but making 7zip the default. https://github.com/microsoft/azure-pipelines-tasks/pull/14626

-edit- please note I am not speaking for the Azure devs here

I have the exact same situation as @ebcdavid. As a matter of fact, we have to cancel our Production deployment because we saw this issue surface all of a sudden. Do we have a timeline for a permanent fix for this? Also, if we could tag such breaking changes to a different major version so as to be backward compatible. I didn’t find any way to specify the old working version in release pipelines. Thanks.

@pixelnix we will update the read md once our new solution reaches to all customers.

So basically if we’re paying for enterprise software we get all the breaking changes rolled out to us first, without proper updates or documentation or even a way to revert to an earlier, working version of the task?

We’ve been having the same issues as described here: https://github.com/microsoft/azure-pipelines-tasks/issues/14595#issuecomment-800602330

Previously this task was using 7zip for the deployment, now as of this update it always tries to use Powershell Core without ensuring that it’s installed on the machine. The fallback behaviour of using Windows Powershell is broken because the expand-archive command does not exist in Windows Powershell.

In short, if you must do updates that override existing functionality (e.g. stopping the use of 7zip) please could you at least make sure that the fallback for your new approach actually works.

File extraction commands exist in Windows Powershell so it shouldn’t be difficult to substitute those for expand-archive if the task falls back to using Windows Powershell.

It definitely appears as though this bug was introduced in: https://github.com/microsoft/azure-pipelines-tasks/commit/92ae148a02b1a174cc212222f9d92b07dc536ea6

The problem continues,

but I managed to get around it by installing PowerShell Core 7.1 on my server

# download the installation code
$code = Invoke-RestMethod -Uri https://aka.ms/install-powershell.ps1
# turn it into a function
$null = New-Item -Path function:Install-PowerShell -Value $code
# run the function
Install-PowerShell -UseMSI -Quiet

So, i restarted the server and ran another deploy, and finally works fine!