Bind CName to Site
Greate example, but am i missing a step in this process.
I have a azure dns with and a cname for example configured as timbo.mywebsite.com. If i create this via "BringExternalDomains" in the new portal. It creates ok. If i delete it and then try to add via the code below, i get
{"Code":"NotFound","Message":"Hostname 'timbo.mywebsite.com' does not exist.","Target":null,"Details":[{"Message":"Hostname 'timbo.mywebsite.com' does not exist."},{"Code":"NotFound"},{"ErrorEntity":{"Code":"NotFound","Message":"Hostname 'timbo.mywebsite.com' does not exist.","ExtendedCode":"04020","MessageTemplate":"Hostname '{0}' does not exist.","Parameters":["timbo.mywebsite.com"],"InnerErrors":null}}],"Innererror":null}
is there a step for BringExternalDomains? I did notice if i run just the code at line90 and then the update command at line 111 the response returns the site with no changes.
https://github.com/davidebbo/AzureWebsitesSamples/blob/master/ManagementLibrarySample/Program.cs#L85
@naveedaz wrote that BindCertificateToSite test method, so I'll let him comment.
I've spotted a Sites.GetSiteHostNameBindingsAsync() and also a Sites.CreateOrUpdateSiteHostNameBindingAsync() If this is required first then its not extirely obvious which of the properties i need to populate on the HostNameBindingobject i need to pass in.
Ok, so this code "Works"
var site = await m_websiteClient.Sites.GetSiteAsync(resourceGrpName, siteName);
var hst = new HostNameBinding();
hst.Name = siteName;
hst.Name = $"{siteName}/{hostName}";
hst.Location = site.Location;
var doms3 = await m_websiteClient.Sites.CreateOrUpdateSiteHostNameBindingAsync(resourceGrpName, siteName, hostName, hst);
Strange thing is that although you can see this entry in the Bring External Domains, blade and you can see the SSL binding for it, it takes a much longer time before its visible in the "Hostnames assigned to site" area. Feels like a step is being missed but some process is fixing in the background.