xWebsite binding failing in pull mode
Hi, I am using xWebsite with Azure Automation DSC to setup a server and I see the below error.
"ErrorRecord": "Failure to add certificate to web binding. Please make sure that the certificate thumbprint "
It works fine if I use it in push mode though. Am I missing anything?
xWebSite WebSite
{
Ensure = "Present"
Name = "TestDSC"
ApplicationPool = "TestDSC"
PhysicalPath = "D:\Inetpub"
BindingInfo = @(
MSFT_xWebBindingInformation
{
Protocol = "HTTPS"
Port = "9443"
CertificateThumbprint = "<my cert thumbprint here>"
}
)
}
When I used dsc debug, I found that it is throwing error exactly at $binding.addsslcertificate call below.

Pretty sure you need to include the Certificate Store Name? At least in the version I am using. BindingInfo = @( MSFT_xWebBindingInformation { Protocol = "HTTPS" Port = 8443 CertificateThumbprint = "71AD93562316F21F74606F1096B85D66289ED60F" CertificateStoreName = "WebHosting" },
@JonosGit Thanks for responding. MY is a default value as mentioned in Convert-To-WebBinding method. I do have my cert in MY. And yes, I did try explicitly mentioning MY but it is the same error.
if ([String]::IsNullOrEmpty($binding.CertificateStoreName))
{
$certificateStoreName = 'MY'
Write-Verbose -Message `
($LocalizedData.VerboseConvertToWebBindingDefaultCertificateStoreName `
-f $certificateStoreName)
}
Any help here? I used debugging to narrow down to exactly which statement is giving this error. The thumbprint is fine and when I take this statement and run it myself, it works fine. It only fails when running in pull mode (with Azure Automation DSC). It runs under system account with both push and pull mode, so what are some other differences I need to know here?
Function : Update-WebsiteBinding Statement : $methodInstance.Execute()
stack trace is
writeErrorStream : True Exception : System.Management.Automation.MethodInvocationException: Exception calling "Execute" with "0" argument(s): "Value does not fall within the expected range." ---> System.ArgumentException: Value does not fall within the expected range. at Microsoft.IIs.PowerShell.Framework.Interop.IAppHostMethodInstance.Execute() at CallSite.Target(Closure , CallSite , Object ) --- End of inner exception stack trace --- at System.Management.Automation.ExceptionHandlingOps.ConvertToMethodInvocationException(Exception exception, Type typeToThrow, String methodName, Int32 numArgs, MemberInfo memberInfo) at CallSite.Target(Closure , CallSite , Object ) at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0) at System.Management.Automation.Interpreter.DynamicInstruction`2.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) TargetObject : CategoryInfo : NotSpecified: (:) [], MethodInvocationException FullyQualifiedErrorId : ArgumentException ErrorDetails : InvocationInfo : System.Management.Automation.InvocationInfo ScriptStackTrace : at Update-WebsiteBinding, C:\Program Files\WindowsPowerShell\Modules\xWebAdministration\1.15.0.0 \DscResources\MSFT_xWebsite\MSFT_xWebsite.psm1: line 2074 at Set-TargetResource, C:\Program Files\WindowsPowerShell\Modules\xWebAdministration\1.15.0.0\Ds cResources\MSFT_xWebsite\MSFT_xWebsite.psm1: line 284 PipelineIterationInfo : {} PSMessageDetails :
@subbunori I will investigate this and get back to you
@subbunori did you get an answer to this issue?
No
On Thu, Apr 26, 2018, 5:48 AM Johan Ljunggren [email protected] wrote:
@subbunori https://github.com/subbunori did you get an answer to this issue?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PowerShell/xWebAdministration/issues/269#issuecomment-384628797, or mute the thread https://github.com/notifications/unsubscribe-auth/AXOyxr5vAjOg5uB9-MMzlQ41HJ5dM6rVks5tscIUgaJpZM4LN0Y8 .
@subbunori Thanks for answering after such a long time! Do you still have this problem or did you find a solution by yourself?