Azure Website - configure SSL Bindings with PowerShell or cross-platform CLI -


Our position is that we often want to add new custom sub-domains for many Azure websites and we need it process So that we can reduce any need for manual intervention and reduce the risk of screwing up some things.

Esure cross-platform CLI tools and powershief CMDlet provide me the scripts with sufficient functionality for everyone, with the obvious exception of SSL binding ... Websites are all HTTPS-only, and which domains We add that SNI SSL binding is required.

Azure Management Portals Allows you to configure SSL binding manually How can I use PowerShell cmdlets or cross-platform CLI tools for the domain of the website? If it is not possible to use any of those devices, then what are some other ways, when we can script the process to add / remove domains to sites? I have finally managed it successfully using Azure Web Sites Management REST API.

The original documentation on which I gave my example below is no longer available 2014, but the EzuR resource explorer Joe Jar has mentioned about the comments and associated with the blog post, in my opinion a better resource is. Direct link:

Service management reverse API reference seems to be the closest thing to the original documents I used, but currently about the Azure Web App (formerly known as Ezur Websites) There is nothing especially in:

Example:

  using the system; Using System.Linq; Using System.Net.Http; Using System.Net.Http.Formatting; Using System.Net.Http.Headers; Using System.Security.Cryptography.X509 certificates; System usage threading. Task; Private constant string managementbumpprint = "0000000000000000000000000000000000000000000000"; Privatecast String Subscription ID = "00000000-0000-0000-0000-000000000000"; Private cast string SSLtumbprint = "0000000000000000000000000000000000000000000000"; Private cast string WebSpace = "East SideWays"; Private constant string website name = "MyWeight"; Private Coast String WebsiteDimine = "Mydomman"; Private Kontakt SSL WebSlate SSL = NetState Public async Task Sets List () {// Get Management Certificate var store = new X509Store (StoreName.My, StoreLocation.CurrentUser); Store.Open (OpenFlags.ReadOnly); Var certificate = store.Certificates.Cast & lt; X509Certificate2 & gt; (). First (xc = & gt; x.shhumbprint.Equals (ManagementTrintPrint, String Comparison: OrdinalIgn Case)); // setup http client var handler = new webquash handler (); Handler.ClientCertificates.Add (certificate); Var Client = New HTTP Client (Handler) {Bidder = New Uri ("https://management.core.windows.net/" + Subscription ID + "/ Services / WebSpace /"}}; Client.DefaultRequestHeaders.Accept.Add (New MediaTypeWithQualityHeaderValue ("App / Jason")); Client.DefaultRequestHeaders.Add ("X-MS-Edition", "2014-06-01"); Var requestData = new {HostNameSslStates = new [] {new {name = websiteDomain, SslState = (long) sslState, thumbprint = sslThumbprint, ToUpdate = true}}}; Var response = wait client.PutAsJsonAsync (webspace + "/ sites /" + website name, request data); } Public enum SslState {disabled = 0, SniEnabled = 1, IpBasedEnabled = 2}  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -