0

I'm deploying an IIS Web App with IIS Web App Deploy Task in Azure DevOps Release Pipeline. This works good but don't set the correct application pool. I'm trying it with set a Parameter in Parameters.xml or as -setParam to the Task. But this doesn't change anything. The googled Solutions didn't help. How can I manipulate the Application Pool during deployment? Thanks.

EDIT

In reference to this answer I configured the parameters.xml and pipeline like this. (appHostConfig instead of appPoolConfig hadn't changed anything)

parameters.xml

<parameters>
    <parameter name="Parameter 1" description="Full site path where you want to install your application (for example, Default Web Site/Application)." defaultValue="Default Web Site/MyApplication" tags="IisApp">
        <parameterEntry kind="ProviderPath" scope="iisApp" match="Default\ Web\ Site/MyApplication" />
    </parameter>
    <parameter name="Parameter 2" description="Enter the name of the application pool." defaultValue="MyAppPool" tags="AppPoolConfig">
        <parameterEntry kind="ProviderPath" scope="appPoolConfig" match="MyAppPool" />
    </parameter>
    <parameter name="IIS Web Application Name" description="Enter the name of the website." defaultValue="MyApplication" tags="IisApp" />
    <parameter name="Application Pool" description="Enter the name of the application pool." defaultValue="MyAppPool" tags="AppPoolConfig" />
</parameters>

Set the website in IIS Web App Deploy Task (results to -setParam:name='IIS Web Application Name',value='Default Web Site/MyApplication')

Website / Application

Set the Application Pool parameter in IIS Web App Deploy Task

Application Name

mburm
  • 1,417
  • 2
  • 17
  • 37

2 Answers2

1

Set Application Pool in IIS Deployment with Azure Release Pipeline

Since you do not share how did you set the Parameter in Parameters.xmland -setParam to the Task, I am not sure if you correct set the Parameter.

You could check this and this thread for some more info.

Anyway, for azure devops, there is an option Application Pool for the task IIS Web App deployment, which we could set the Application Pool:

enter image description here

Besides, the IIS Web App deployment is currently deprecated, MS recommends the task WinRM - IIS Web App Management.

Update:

There is an option Configuration type, select IIS Website:

enter image description here

Please check this document for some more details.

Hope this helps.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135
  • 1
    Thanks for the answer. I edited the post how the parameters.xml and the pipeline are configured. I've already seen the IIS App Management Task. In this I have to set all parameters like pipeline mode or credentials in every pipeline which will release a website with this application pool (and this will be a lot). If this would be the best option then I would do this and set this with variable group parameters. But I would prefer something where I have only to set the Application Pool name without all other pool settings. – mburm Apr 16 '20 at 08:09
  • 1
    @mburm, You could create a task group for the IIS App Management Task, so that we do not need to set all parameters in every pipeline one by one. – Leo Liu Apr 16 '20 at 09:51
  • The Task Groups are a great idea and this makes a lot of things easier in our deployment process. The IIS App Management Task works and I can create an application pool should it not exists. But farther it doesn't work with the binding to the application. There I get again the default pool. – mburm Apr 17 '20 at 17:03
  • @mburm, Sorry i misunderstood your question, if you want to binding the application pool to the application, you could select the `IIS Website` in the `Configuration type`, then enable the checkbox **Create or update app pool**. Check if my update answer give any helps. Have a nice day :). – Leo Liu Apr 20 '20 at 08:44
  • @mburm, Any update for this issue? Have you resolved this issue? If not, would you please let me know the latest information about this issue? – Leo Liu Apr 21 '20 at 04:00
  • I am having the same problem. It will create the missing application pool in IIS, but it will not change the Web site to use the new or existing app pool. The Release Pipeline does not give an error message either; it just doesn't alter the app pool setting on the server. I also grabbed the appcmd.exe command from the Release log and ran it myself on the server. Again, it completed without an error but did not change the app pool setting of the site. – Bryan Williams Jul 16 '21 at 14:03
0

Create inline PowerShell Script task after Web App Deploy with:

c:\windows\system32\inetsrv\AppCmd.exe set app /app.name:"APPLICATIONNAMEHERE" /applicationpool:"APPLICATIONPOOLNAMEHERE" 

to assign the application pool created above.

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
Crisci
  • 1
  • 1
  • I received an error message "ERROR ( message:Must use exact identifer for APP object with verb SET. )" – Crisci May 25 '23 at 21:34