We are trying to use PowerShell script to modify the Anonymous Identity to that of the corresponding App Pool. The following command works while manually running on the server from a elevated powershell prompt:
Add-WebConfiguration –filter /system.webServer/security/authentication/anonymousAuthentication 'IIS:\Sites\api’
Set-Webconfigurationproperty –filter /system.webServer/security/authentication/anonymousAuthentication ‘IIS:\Sites\api’ –name username –value ‘’
When we add this to a Powershell script step during deployment it runs without error but Auth is not changed as expected. When we run it as a post package deployment script we get the following error:
Failed: CustomScriptConvention.PostDeploy.ps1
11:38:06 Verbose | Running PowerShell script: \fs-01\inetpub\api\CustomScriptConvention.PostDeploy.ps1
11:38:08 Error | Add-WebConfiguration : A positional parameter cannot be found that accepts
11:38:08 Error | argument ‘IIS:\Sites\api’.
11:38:08 Error | At \fs-01\inetpub\api\CustomScriptConvention.PostDeploy.ps1:10 char:1
11:38:08 Error | + Add-WebConfiguration â?"filter
11:38:08 Error | /system.webServer/security/authentication/anonymo …
11:38:08 Error | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11:38:08 Error | ~~~
11:38:08 Error | + CategoryInfo : InvalidArgument: ( [Add-WebConfiguration], Par
11:38:08 Error | entContainsErrorRecordException
11:38:08 Error | + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.IIs.PowerS
11:38:08 Error | hell.Provider.AddConfigurationCommand
11:38:08 Fatal | PowerShell script returned a non-zero exit code: 1
| Tentacle version 2.6.5.1010
Any insight to getting these commands to work during deployment would be much appreciated.