Search code examples
iisazure-pipelinesazure-pipelines-release-pipeline

Issue with IIS web app manage task - always thinks there are changes to site object


I am trying to create a site on ISS on one of our machines. The task keeps thinking that the site object changes, even though no changes occurred.

If IIS has no sites, deployment works fine.

2023-12-07T09:35:57.7693529Z ##[section]Starting: Ensure speedadmin.dk exists
2023-12-07T09:35:57.8140181Z ==============================================================================
2023-12-07T09:35:57.8140593Z Task         : IIS web app manage
2023-12-07T09:35:57.8140779Z Description  : Create or update websites, web apps, virtual directories, or application pools
2023-12-07T09:35:57.8140909Z Version      : 0.198.0
2023-12-07T09:35:57.8141078Z Author       : Microsoft Corporation
2023-12-07T09:35:57.8141248Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/iis-web-app-management-on-machine-group
2023-12-07T09:35:57.8141374Z ==============================================================================
2023-12-07T09:35:58.7649910Z ##[command]"C:\Windows\system32\inetsrv\appcmd.exe"  list apppool /name:"prod-a.speedadmin.dk"
2023-12-07T09:35:58.8069878Z ##[command]"C:\Windows\system32\inetsrv\appcmd.exe"  set apppool /apppool.name:"prod-a.speedadmin.dk" -managedRuntimeVersion:v4.0 -managedPipelineMode:Integrated -processModel.identityType:NetworkService
2023-12-07T09:35:58.8629729Z APPPOOL object "prod-a.speedadmin.dk" changed
2023-12-07T09:35:58.8695365Z ##[command]"C:\Windows\system32\inetsrv\appcmd.exe"  list site /name:"prod-a.speedadmin.dk"
2023-12-07T09:35:58.9114872Z ##[command]"C:\Windows\system32\inetsrv\appcmd.exe"  add site /name:"prod-a.speedadmin.dk" /physicalPath:"D:\speedadmin\websites\prod-a\www.speedadmin.dk"
2023-12-07T09:35:58.9735551Z SITE object "prod-a.speedadmin.dk" added
2023-12-07T09:35:58.9735878Z APP object "prod-a.speedadmin.dk/" added
2023-12-07T09:35:58.9736067Z VDIR object "prod-a.speedadmin.dk/" added
2023-12-07T09:35:58.9837187Z ##[command]"C:\Windows\system32\inetsrv\appcmd.exe"  set site /site.name:"prod-a.speedadmin.dk" -applicationDefaults.applicationPool:"prod-a.speedadmin.dk" -[path='/'].[path='/'].physicalPath:"D:\speedadmin\websites\prod-a\www.speedadmin.dk" -[path='/'].[path='/'].userName: -[path='/'].[path='/'].password:
2023-12-07T09:35:59.0528195Z SITE object "prod-a.speedadmin.dk" changed
2023-12-07T09:35:59.0678012Z ##[command]"C:\Windows\system32\inetsrv\appcmd.exe"  list sites
2023-12-07T09:35:59.1225210Z ##[command]"C:\Windows\system32\inetsrv\appcmd.exe"  set site /site.name:"prod-a.speedadmin.dk" /+bindings.[protocol='http',bindingInformation='10.200.36.20:80:']
2023-12-07T09:35:59.1900561Z SITE object "prod-a.speedadmin.dk" changed
2023-12-07T09:35:59.1958739Z ##[command]"C:\Windows\system32\inetsrv\appcmd.exe"  list sites
2023-12-07T09:35:59.2354584Z ##[command]"C:\Windows\system32\inetsrv\appcmd.exe"  set site /site.name:"prod-a.speedadmin.dk" /+bindings.[protocol='http',bindingInformation='*:80:']
2023-12-07T09:35:59.2924492Z SITE object "prod-a.speedadmin.dk" changed
2023-12-07T09:35:59.2973340Z ##[command]"C:\Windows\system32\inetsrv\appcmd.exe"  list sites
2023-12-07T09:35:59.3377913Z ##[command]"C:\Windows\system32\inetsrv\appcmd.exe"  set site /site.name:"prod-a.speedadmin.dk" /+bindings.[protocol='https',bindingInformation='10.200.36.20:443:']
2023-12-07T09:35:59.3959136Z SITE object "prod-a.speedadmin.dk" changed
2023-12-07T09:35:59.4098275Z ##[command]"netsh" http show sslcert ipport=10.200.36.20:443
2023-12-07T09:35:59.4526745Z ##[command]"netsh" http add sslcert ipport=10.200.36.20:443 certhash=*** appid={0d6bcddc-160c-4a7e-9109-5d4268433956} certstorename=MY
2023-12-07T09:35:59.4895986Z 
2023-12-07T09:35:59.4896413Z SSL Certificate successfully added
2023-12-07T09:35:59.5156955Z 
2023-12-07T09:35:59.5157533Z ##[command]"C:\Windows\system32\inetsrv\appcmd.exe" set config /section:applicationPools -[name='prod-a.speedadmin.dk'].startMode:AlwaysRunning
2023-12-07T09:35:59.5899922Z Applied configuration changes to section "system.applicationHost/applicationPools" for "MACHINE/WEBROOT/APPHOST" at configuration commit path "MACHINE/WEBROOT/APPHOST"
2023-12-07T09:35:59.6189008Z ##[section]Finishing: Ensure speedadmin.dk exists

Second run of the release fails, even though I have not changed anything about the site or the deployment script.

2023-12-07T09:37:09.8796578Z ##[section]Starting: Ensure speedadmin.dk exists
2023-12-07T09:37:09.9264703Z ==============================================================================
2023-12-07T09:37:09.9265143Z Task         : IIS web app manage
2023-12-07T09:37:09.9265330Z Description  : Create or update websites, web apps, virtual directories, or application pools
2023-12-07T09:37:09.9265474Z Version      : 0.198.0
2023-12-07T09:37:09.9265648Z Author       : Microsoft Corporation
2023-12-07T09:37:09.9265814Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/iis-web-app-management-on-machine-group
2023-12-07T09:37:09.9265927Z ==============================================================================
2023-12-07T09:37:10.8776860Z ##[command]"C:\Windows\system32\inetsrv\appcmd.exe"  list apppool /name:"prod-a.speedadmin.dk"
2023-12-07T09:37:10.9211992Z ##[command]"C:\Windows\system32\inetsrv\appcmd.exe"  set apppool /apppool.name:"prod-a.speedadmin.dk" -managedRuntimeVersion:v4.0 -managedPipelineMode:Integrated -processModel.identityType:NetworkService
2023-12-07T09:37:10.9795257Z APPPOOL object "prod-a.speedadmin.dk" changed
2023-12-07T09:37:10.9860198Z ##[command]"C:\Windows\system32\inetsrv\appcmd.exe"  list site /name:"prod-a.speedadmin.dk"
2023-12-07T09:37:11.0369832Z ##[command]"C:\Windows\system32\inetsrv\appcmd.exe"  set site /site.name:"prod-a.speedadmin.dk" -applicationDefaults.applicationPool:"prod-a.speedadmin.dk" -[path='/'].[path='/'].physicalPath:"D:\speedadmin\websites\prod-a\www.speedadmin.dk" -[path='/'].[path='/'].userName: -[path='/'].[path='/'].password:
2023-12-07T09:37:11.1063363Z SITE object "prod-a.speedadmin.dk" changed
2023-12-07T09:37:11.1212169Z ##[command]"C:\Windows\system32\inetsrv\appcmd.exe"  list sites
2023-12-07T09:37:11.1765311Z ##[command]"C:\Windows\system32\inetsrv\appcmd.exe"  list sites
2023-12-07T09:37:11.2176552Z ##[command]"C:\Windows\system32\inetsrv\appcmd.exe"  list sites
2023-12-07T09:37:11.2695373Z ##[command]"netsh" http show sslcert ipport=10.200.36.20:443
2023-12-07T09:37:11.3123572Z ##[command]"netsh" http add sslcert ipport=10.200.36.20:443 certhash=*** appid={8e2de72e-4c25-4e53-ac4a-d62bd506e522} certstorename=MY
2023-12-07T09:37:11.3498120Z 
2023-12-07T09:37:11.3498463Z SSL Certificate add failed, Error: 183
2023-12-07T09:37:11.3499049Z Cannot create a file when that file already exists.
2023-12-07T09:37:11.3499891Z 
2023-12-07T09:37:11.3499933Z 
2023-12-07T09:37:11.4604555Z ##[error]Process 'netsh' exited with code '1'.
2023-12-07T09:37:11.4803066Z ##[section]Finishing: Ensure speedadmin.dk exists

According to the script, it thinks that the site changed. But even if the deployment parameters changed, I don't think that it should fail since the bindings are not used by any other site.

IIS is empty - there are no other sites on it.

Configuration looks like so: enter image description here

Variables look like so: enter image description here


Solution

  • This seems is a known issue for IIS web app manage task. See below tickets:

    From the second ticket, looks like, this issue had been reported to the engineer team for fix. However, there is no update from the engineer team currently.


    As workaround currently, you can try to add a PowerShell task to execute below command before the IIS web app manage task in your pipeline.

    This command will remove the certificate added in the previous run.

    netsh http delete sslcert hostnameport={siteUrl}:443