Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add credentials with empty password in xWebAppPool. #610

Open
pwyrwas opened this issue Jun 7, 2022 · 2 comments
Open

How to add credentials with empty password in xWebAppPool. #610

pwyrwas opened this issue Jun 7, 2022 · 2 comments
Labels
question The issue is a question.

Comments

@pwyrwas
Copy link

pwyrwas commented Jun 7, 2022

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.

@johlju
Copy link
Member

johlju commented Jun 7, 2022

It is not possible to use empty password for a property using PSCredential type. See #581 (comment).

@johlju johlju added the question The issue is a question. label Jun 7, 2022
@quillypowers
Copy link

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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question The issue is a question.
Projects
None yet
Development

No branches or pull requests

3 participants