Can I in a step choose type of IIS Application Pool user depending on environment

Hi

For a website I am deploying I need to set different types of application pool users depending on environment. In our test environment I use a custom user but in our staging and production environments I use the Network Service user.

I it possible to change the type of user in a single step depending on environment or do I need to create a copy of that step and specify which environments each step applies to?

Hi,

Thanks for getting in touch! It is possible but it is rather tricky. Here’s how:

  1. Create the variables Identity(x2), Password and Username. See attached screenshot variables.jpg for better reference on what should the scope be for each variable (super important).

  2. Open your Nuget package deploy step and set the App pool identity to “Custom User”. Then populate the field “Username” with the value #{Username} and the field “Password” with #{Password}. For the “Password” field you’re gonna have to check the checkbox at the right of the field to allow custom expressions. It should look as shown on CustomUser.jpg

  3. Now the tricky part: Go back to the field “Identity”, click on the checbox at the right to allow custom expressions, and put #{Identity} on that field. It should look as shown on Identity.jpg

When you deploy to “Test”, the identity will be set to “Custom User” and the Username and Password will be used to configure the App Pool. When you deploy to Staging or Production, the Identity will be set to “Network service user” and the username and password will be ignored.

Let me know if this all made sense to you :slight_smile:

Thanks!

Dalmiro.

Hi

Thanks for the reply. I had to split my process into separate scoped steps for other reasons.

Best regards
Nils

The suggested approach seems to have stopped working in the latest version.

From the release notes for 3.2.11:
2229 - IIS app pool credentials are cleared if the selected identity is not a custom user.

Hi Jarl,

Could you explain a bit more what is happening in your scenario?

If possible also include:

  • Exact Octopus version you are running.

  • Screenshots similar to the ones on my previous reply.

  • Follow the instructions below to provide a full deployment log

1) Add these 2 variables to your project http://docs.octopusdeploy.com/display/OD/Debug+problems+with+Octopus+variables

2) Create a new release (so the new variables take effect) and deploy it. If possible skip as many steps as you can and only leave step we are troubleshooting in order to avoid the noise in the log.

3) Send us the raw log of that deployment http://docs.octopusdeploy.com/display/OD/Get+the+raw+output+from+a+task

Regards,
Dalmiro

Hi.
The problem is that when I enter switch AppPoolIdentity from Custom User to custom expression (in my case #{AppPoolIdentity}) and save, the username is blanked. No deploy neccessary to confirm, the field is no longer in the octopus-database. However projects from before we last updated still works perfectly, until you edit them. This seems to be a simple gui problem.

We use Octopus 3.2.19-ci0001

Skjermdump_fra_2016-01-27_09-02-05.png

Skjermdump_fra_2016-01-27_09-02-47.png

Skjermdump_fra_2016-01-27_09-04-08.png

Hi Jarl,

Thanks for the detailed description. I was able to reproduce this and created a github issue to do something about it: https://github.com/OctopusDeploy/Issues/issues/2333

If possible, please upgrade from 3.2.19-ci0001 to the latest version. That version with the ci0001 tag was released accidentally and we pulled it off right away (our database shows that only 20 users installed it, and you seem to be one of those). Even though we didn’t encounter any errors with that version, it’ll be better if you upgrade to an official release. Upgrading to last night’s 3.2.21 would do.

Regards,
Dalmiro