I am using the “Deploy to IIS” built-in step to deploy to IIS, where I have two HTTPS bindings with two different certificates - CERT1 and CERT2. If I only use the 1st binding, it works fine. If I enable the 2nd binding, I get an error.
System.Exception: Could not find certificate with thumbprint 'CERT1' in store Cert:\LocalMachine\My
Previously I can see in the output that both certificates have been imported properly, though the 1st one (CERT1) is imported in WebHosting, while the 2nd (CERT2) one in My. I wonder why are not both imported in WebHosting. But it seems there is an error in the step script, it seems to assume both certificates get imported to the same store, because the error is for the 1st certificate, but it checks the wrong store.
Thanks for pointing me to the issue. I have now temporarily resolved it by inserting a step before to import the certificate in LocalMachine\WebHosting.