I'm using Microsoft.WindowsAzure.Management.WebSites 4.4.2-prerelease
library to create/modify Azure WebApps. I can create the app, can change settings, can add a custom domain. Next step is to add SSL certificate.
Here is how I do it:
public async Task<WebSiteUpdateResponse> UpdateSslCertificate(String sitename)
{
var updateParameters = new WebSiteUpdateParameters()
{
HostNameSslStates = new List<WebSiteUpdateParameters.WebSiteHostNameSslState>()
{
new WebSiteUpdateParameters.WebSiteHostNameSslState()
{
ToUpdate = true,
Name = "mysubdomain.mydomain.com",
SslState = WebSiteSslState.SniEnabled,
Thumbprint = "blbhbblblblblblblbMyCertTHUMBPRINT",
},
},
};
var updateResult = await client.WebSites.UpdateAsync("Default-NorthEuropewebspace", sitename, updateParameters);
return updateResult;
}
But after adding the cert I can't see the cert added to the site in the portal:
Cert is wildcard cert and is already uploaded. If I use the new portal to add SSL cert to the site - I can do it with no problem, so that is not a pricing issue.
Also if I go to Azure Resource Manager and navigate to that site and look for SslStates, I get this:
"hostNameSslStates": [
{
"name": "mysubdomain.mydomain.com",
"sslState": 0,
"ipBasedSslResult": null,
"virtualIP": null,
"thumbprint": null,
"toUpdate": null,
"toUpdateIpBasedSsl": null,
"ipBasedSslState": 0,
"hostType": 0
},
{
"name": "testingcreation.azurewebsites.net",
"sslState": 0,
"ipBasedSslResult": null,
"virtualIP": null,
"thumbprint": null,
"toUpdate": null,
"toUpdateIpBasedSsl": null,
"ipBasedSslState": 0,
"hostType": 0
},
{
"name": "testingcreation.scm.azurewebsites.net",
"sslState": 0,
"ipBasedSslResult": null,
"virtualIP": null,
"thumbprint": null,
"toUpdate": null,
"toUpdateIpBasedSsl": null,
"ipBasedSslState": 0,
"hostType": 1
}
],
So the new cert is added, only state is 0 (WebSiteSslState.Disabled
) and no thumbprint stored.
Am I doing something wrong? How can I assign SSL cert to a site?