microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.47k stars 2.6k forks source link

IIS Web App Manage: Process 'netsh' exited with code '1' #17462

Open patrykpluraparka opened 1 year ago

patrykpluraparka commented 1 year ago

Note

Issues in this repo are for tracking bugs, feature requests and questions for the tasks in this repo

For a list:
https://github.com/Microsoft/azure-pipelines-tasks/tree/master/Tasks

If you have an issue or request for the Azure Pipelines service, use developer community instead:

https://developercommunity.visualstudio.com/spaces/21/index.html )

Required Information

Entering this information will route you directly to the right team and expedite traction.

Question, Bug, or Feature?
Type: Bug

Enter Task Name: IISWebAppManagementOnMachineGroupV0

list here (V# not needed): IISWebAppManagementOnMachineGroupV0 https://github.com/Microsoft/azure-pipelines-tasks/tree/master/Tasks

Environment

Azure Pipeline

Issue Description

In Releases tab I use IIS Web App Manage task with enabled bindings (80 and 443) on one site: www.example.com First release deployment was ok, biding was configured and all works. When I want deploy release second time I got this error message:

2022-12-08T11:00:04.6529364Z ##[command]"netsh" http show sslcert ipport=0.0.0.0:443 2022-12-08T11:00:04.7461192Z ##[command]"netsh" http add sslcert ipport=0.0.0.0:443 certhash=*** appid={some-guid} certstorename=certstorage 2022-12-08T11:00:04.8145306Z 2022-12-08T11:00:04.8146373Z SSL Certificate add failed, Error: 183 2022-12-08T11:00:04.8147405Z Cannot create a file when that file already exists. 2022-12-08T11:00:04.8147929Z 2022-12-08T11:00:04.8148137Z 2022-12-08T11:00:05.0409362Z ##[error]Process 'netsh' exited with code '1'. 2022-12-08T11:00:05.0675934Z ##[section]Finishing: IIS Web App Manage

After a small debugging I figure out: script: MSDeployOnTargetMachines.ps1 require binding as four object in object array $isItSameBinding = $result.Get(4).Contains([string]::Format("{0}:{1}", $hostname, $port)) Script location: Tasks > IISWebAppDeployment > MsDeployOnTargetMachines.ps1

But netssh command generate it on 6 position netsh output

I also noticed that this bug appear when i start using OS: Windows Server 2022 Datacenter Azure Edition

Task logs

tasklog_6.log

Troubleshooting

Checkout how to troubleshoot failures and collect debug logs: https://docs.microsoft.com/en-us/vsts/build-release/actions/troubleshooting

Error logs

Process 'netsh' exited with code '1'.

miniragnarok commented 1 year ago

I have the exact same issue. We've created a new instance of Windows Server 2022. Our old one is Windows Server 2012. The exact same pipeline deploys to both servers but only the Windows Server 2022 one fails and it has the same error message. I looked into the logs between both deployments and the one that works correctly detects that the binding exists already. The one that doesn't work tries to add a new one instead of ignoring it.

miniragnarok commented 1 year ago

Note that this is a duplicate bug of this one from a year ago. https://github.com/microsoft/azure-pipelines-tasks/issues/15686

craigeddy commented 1 year ago

Would be nice to have this fixed. We're experiencing it in several environments.

jabteles commented 1 year ago

+1 preventing to migrate to Server 2022. No more workarounds.

anujmca commented 1 year ago

Do we have a solution to this, other than not migrating to windows server 2022?

patryk-plura commented 1 year ago

Half a year later... Still, the best option is to disable the "Add binding" option in the deployment process and handle it by yourself.

PhilBlackRose commented 11 months ago

I also have this issue and it is also preventing my datacentre from moving to Windows 2022.

v-schhabra commented 7 months ago

Hi @PhilBlackRose, @patryk-plura, The mentioned issue has been fixed in this PR https://github.com/microsoft/azure-pipelines-extensions/pull/1220 Could you please use the IISWebAppManagementV3 version of the task and test if it is working fine?

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

miniragnarok commented 1 month ago

This issue has still not been fixed as of a couple of weeks ago. Every time there's an update to the MSDeployOnTargetMachines.ps1 script I have to recreate my workaround for Windows Server 2022 VMs.