简体   繁体   中英

Using powershell to Set-WebConfigurationProperty on a web application with a parent site

I'm trying to modify this Octopus Deploy step template to enable anonymousAuthentication on the newly created application

My application has a parent site, so it's going to be something like

MyParentSite\\MyChildSite

Is it possible to target the parentSite \\ name something like the below?

Set-WebConfigurationProperty  
-filter /system.WebServer/security/authentication/anonymousAuthentication  
-name enabled  
-value true 
-location $parentSite\$name

Or am I using the wrong property?

I'm not sure if you're aware but you can set "Anonymous Authentication" using the default NuGet package deployment step. It's as simple as clicking a checkbox.

Within the built-in "Deploy a NuGet Package" step, click on "Configure features" towards the bottom of the step. Select "IIS website and application pool". From there, you should see these options:

在此处输入图片说明

You can definitely script out your solution if you so choose, but a lot of people don't realize this menu exists by default within Octopus because it's buried in the "Configure features" settings. I realize you're asking a PowerShell question and I'm responding with a non-PowerShell answer, but this may be the simpler path to getting what you want.

您只需要使用正斜杠而不是反斜杠:

Set-WebConfigurationProperty -filter /system.WebServer/security/authentication/anonymousAuthentication -name enabled -value true -location $parentSite/$name

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM