homeblogdeploying iis and aspnet puppet

Deploying IIS and ASP.NET with Puppet

Editor’s note: This is one in a series of posts about using Puppet to automate your Windows servers. Follow us on social media or subscribe to our our RSS feed to be notified when the next post is released.

Puppet has deep support for Windows Server systems. Puppet can automate it all, including file system ACLs, registry settings, users & groups, DSC, Chocolatey, WSUS client, PowerShell and even Azure virtual machines. In this post, we’ll explore automating two common Windows tasks with Puppet Enterprise: deploying ASP.NET and IIS.

With Puppet you write a manifest, or set of rules, for your server environments. Puppet checks in with a centralized master every 30 minutes to see if there have been any undesired changes on agent systems, and attempts to apply newly desired configuration or remediate undesirable configuration changes. Setting up IIS and ASP.NET with Puppet is no different. First, we’ll write a basic manifest that defines what we want and then we’ll apply it to our Windows servers.

This is what the code looks like:

We’re using our Windows Feature Module to enable .NET Framework 4.5. We’re also enabling IIS, and turning on HTTP errors and logging. Finally, we’re using the community provided voxpopuli IIS module to remove the default binding.

Puppet runs and generates a report to let us know what happened. In our case, the report shows that a number of things were changed.


From the report we see that Puppet executed the commands necessary to se tup a basic web application. In addition, the IIS Management tools are installed and our Puppet module executed some PowerShell code to remove the default web site as desired.

With the following code, Puppet can also install SQL Server Compact Edition, which our demo ASP.NET application requires.

Now let’s use Puppet to install a bare-bones application that uses SQL Server installed in the previous step. In this case, it’s Razor C, which is an ASP.NET-based CMS. Here’s what the Puppet code looks like for installing Razor C:

We pointed Puppet to a zip file, containing the full distribution of the application. Puppet will copy the zip file from our module, stage it in a temporary directory and extract it to the default location for ASP.NET applications on disk at c:\inetpub\wwwroot. We have also created an application pool and a site mapped to Port 80, pointing to the location on disk where the Razor C application has been extracted.

With just a short bit of manifest code, we have configured Windows to run IIS and have installed a CMS application.

Viewing this within a browser, we see the deployed application:


That’s just one of hundreds of things you can do with Puppet in a Windows server. In our next piece we’ll explore how we can manage PowerShell DSC with Puppet. Stay tuned!

Ethan Brown is a principal software engineer at Puppet.

Learn more

  • You can learn a lot more about how to manage Windows environments with Puppet in our Windows webinars.
  • Haven't tried Puppet Enterprise yet? Learn how it works by downloading our Learning VM and getting your hands dirty.