How to add credentials with empty password in xWebAppPool.
Hello,
base on #80 i saw that is possibility to put empty password when I have account wihtout a password. But I have problem to do this. I'am trying in that way:
Configuration IisConfiguration
{
Import-DscResource -ModuleName xWebAdministration
Import-DscResource -ModuleName PSDscResources -ModuleVersion "2.12.0.0"
$password = "test"
$pw= ConvertTo-SecureString $password -AsPlainText -Force
$un = "user$";
$credential = New-Object System.Management.Automation.PSCredential ($un, $pw)
Node $NodeName
{
xwebapppooldefaults pooldefaults
{
issingleinstance = 'yes'
managedruntimeversion = ''
identitytype = 'applicationpoolidentity'
}
xwebsitedefaults sitedefaults
{
issingleinstance = 'yes'
logformat = 'iis'
logdirectory = 'd:\inetpub\logs\logfiles'
tracelogdirectory = 'd:\inetpub\logs\failedreqlogfiles'
}
xWebAppPool MyApi
{
Name = 'API'
Ensure = 'Present'
State = 'Started'
autoStart = $true
identityType = 'SpecificUser'
Credential = $credential
}
}
}
$configData = @{
AllNodes = @(
@{
NodeName = "*";
PSDscAllowPlainTextPassword = $true
}
@{
NodeName = "localhost";
Roles=@("web")
}
)
}
IisConfiguration -ConfigurationData $configData
The result is that I have set accout without $. How to set accout with $. It is possible directly in IIS.
It is not possible to use empty password for a property using PSCredential type. See https://github.com/dsccommunity/WebAdministrationDsc/issues/581#issuecomment-663145677.
If you're saying the account has no password because it's a gmsa, you can assign below to the credential. Credential = New-Object System.Management.Automation.PSCredential("Domain\Account", (ConvertTo-SecureString "Test" -AsPlainText -Force))
But if it's a gmsa it's a domain account, so you also need to decorate your node data with: PSDscAllowDomainUser = $true;