AuthenticationInfo PowerShell DSC Error

Hi guys, I am trying to implement AuthenticationInfo as i create a website using powershell dsc. When I run the script with the AuthenticationInfo included, I get this error:

Write-NodeMOFFile : Invalid MOF definition for node ‘localhost’: Exception calling “ValidateInstanceText” with “1” argument(s): "Convert property
‘AuthenticationInfo’ value from type ‘INSTANCE’ to type ‘INSTANCE’ failed

How do I resolve this one?

Here’s the script:

Ensure = “Present”
Name = $WebSiteName
State = “Started”
PhysicalPath = $PhysicalPath
ApplicationPool = $AppPool
BindingInfo = @(
MSFT_xWebBindingInformation
{
Protocol = $Protocol
HostName = $HostName
Port = $Port
IPAddress = $IPAdd
CertificateThumbprint = $CertificateThumbPrint
CertificateStoreName = $CertificateStoreName
})
AuthenticationInfo = @(
MSFT_xWebAuthenticationInformation
{
Anonymous = “True”
Basic = “False”
Digest = “True”
Windows = “False”
})

Im assuming you have the latest v1.11.0.0 from the Gallery ?

Also, not sure you really need the hash before the values, like in BindingInfo

AuthenticationInfo =  MSFT_xWebAuthenticationInformation
 {
 Anonymous = "True"
 Basic = "False"
 Digest = "True"
 Windows = "False"
 }

Could only find something about a known bug

https://github.com/PowerShell/xWebAdministration/issues/133
https://github.com/PowerShell/xWebAdministration/issues/138

that hopefully will be fixed soon.

If you omit the entire section of AuthenticationInfo, does it all work well ?

Can see changes have been made in May to this
https://github.com/PowerShell/xWebAdministration/commit/9a804ffbea1c90b77581a9a850cba18fa42e3a56

As I cant test this myself, you might want to download the latest dev branch from the xWebAdministration repo on GitHub
and test it.

hi Arie,

Yes it is the latest xWebAdministration module. I also tried changing it to hash but won’t work.

Yes, the whole script works if I remove the AuthenticationInfo.

I am still having problems with it.

Other then trying the latest Dev version as I noted above can only hope
we can have Nitin or someone from the PS team add to this conversation.

Yup. How can we add them here? Or they should be invited?

They sometimes visit the forum. You can try to go to the GitHub Repo for xWebAdministration
and open an issue there with all the documentation you have

Try this:

    Ensure = "Present"
    Name = $WebSiteName
    State = "Started"
    PhysicalPath = $PhysicalPath
    ApplicationPool = $AppPool
    BindingInfo = @(
    MSFT_xWebBindingInformation
    {
    Protocol = $Protocol
    HostName = $HostName
    Port = $Port
    IPAddress = $IPAdd
    CertificateThumbprint = $CertificateThumbPrint
    CertificateStoreName = $CertificateStoreName
    })
    AuthenticationInfo = MSFT_xWebAuthenticationInformation
    {
    Anonymous = $True
    Basic = $False
    Digest = $True
    Windows = $False
    }

Wow. Thanks Nitin! It Worked like magic. I was wondering why is it declared differently as the BindingInfo?

BindingInfo is an array while AuthenticationInfo is a single element and has to be declared likewise.

Oh. I see. Many thanks for the help! :slight_smile: