AuthenticationInfo PowerShell DSC Error

This topic contains 9 replies, has 3 voices, and was last updated by Profile photo of Hadrean Ocampo Hadrean Ocampo 5 months, 4 weeks ago.

  • Author
    Posts
  • #42175
    Profile photo of Hadrean Ocampo
    Hadrean Ocampo
    Participant

    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"
    })

  • #42189
    Profile photo of Arie H
    Arie H
    Participant

    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.
    https://github.com/PowerShell/xWebAdministration

    • This reply was modified 5 months, 4 weeks ago by Profile photo of Arie H Arie H.
    • #42201
      Profile photo of Hadrean Ocampo
      Hadrean Ocampo
      Participant

      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.

  • #42214
    Profile photo of Arie H
    Arie H
    Participant

    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.

    • #42221
      Profile photo of Hadrean Ocampo
      Hadrean Ocampo
      Participant

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

  • #42224
    Profile photo of Arie H
    Arie H
    Participant

    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

  • #42348
    Profile photo of Nitin Gupta
    Nitin Gupta
    Participant

    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
    }

    • #42385
      Profile photo of Hadrean Ocampo
      Hadrean Ocampo
      Participant

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

  • #42387
    Profile photo of Nitin Gupta
    Nitin Gupta
    Participant

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

    • #42389
      Profile photo of Hadrean Ocampo
      Hadrean Ocampo
      Participant

      Oh. I see. Many thanks for the help! 🙂

You must be logged in to reply to this topic.