# IIS Application Pool - Specific Identity

**URL:** <https://forum.ansible.com/t/iis-application-pool-specific-identity/24011>\
**Category:** Ansible Project\
**Created:** [March 19, 2017, 3:29pm UTC](https://forum.ansible.com/t/iis-application-pool-specific-identity/24011 "2017-03-19T15:29:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DevOps\_Unleashed](https://avatars.discourse-cdn.com/v4/letter/d/ecd19e/32.png) [@DevOps\_Unleashed](https://forum.ansible.com/u/DevOps_Unleashed)\
**Post date:** [March 19, 2017, 3:29pm UTC](https://forum.ansible.com/t/iis-application-pool-specific-identity/24011/1 "2017-03-19T15:29:05Z")

</div>

Is it possible to use Ansible to create a new IIS Application Pool that runs under a specific “identity”?

Cheers

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [March 20, 2017, 4:27pm UTC](https://forum.ansible.com/t/iis-application-pool-specific-identity/24011/2 "2017-03-20T16:27:20Z")

</div>

Yes, but its two steps at the moment and the second step isn’t idempotent.

Try something like this:

# create the app pool first

- name: Update/Create DefaultAppPool  
win\_iis\_webapppool:  
name: ‘DefaultAppPool’  
state: started  
attributes: managedRuntimeVersion:v4.0|enable32BitAppOnWin64:true  
register: DefaultAppPool

# then switch to running as a (domain) user

- name: configure listed app pools to run as correct user  
win\_command: ‘C:\Windows\System32\inetsrv\appcmd.exe set config /section:applicationPools "/[name=’‘{{ item }}’‘].processModel.identityType:SpecificUser" "/[name=’‘{{ item }}’‘].processModel.userName:{{ fdomain }}{{ user }}" "/[name=’‘{{ item }}’‘].processModel.password:{{ credential }}"’  
with\_items:
- DefaultAppPool
- SomeOtherAppPool
