1010 To automate the installation of Let's Encrypt SSL certificate on your Azure Web App, a few things need to be configured. The certificate is installed and renewed using the Azure Resource Manager API, because the renewal process should run unattended you need to register an Azure AD service principal that have access to at least the Azure Web App. Read more about how to register a service principal <a href =" http://blogs.msdn.com/b/visualstudioalm/archive/2015/10/04/automating-azure-resource-group-deployment-using-a-service-principal-in-visual-studio-online-build-release-management.aspx" >here</a >.
1111</p >
1212<p >
13- Once you have registered a service principal, you should add the following App Setting, since the site extension reads them from there. You can register them manually or enter them below and check 'Update Web App Settings'.
13+ Once you have registered a service principal, you should add the following App Setting, since the site extension reads them from there. You can register them manually or enter them below and check 'Update Web App Settings'.
1414</p >
1515<table class =" table table-striped" >
1616 <thead >
1717 <tr >
18- <th >Key</th ><th >Value</th >
18+ <th >Key</th >
19+ <th >Value</th >
1920 </tr >
2021 </thead >
2122 <tbody >
9394 </tbody >
9495 </table >
9596</div >
97+
98+
99+
96100@using (Html .BeginForm ())
97101{
98102 @* @Html.AntiForgeryToken()*@
99103
104+
100105 @Html.HiddenFor(model => model .AuthenticationEndpoint )
101106 @Html.HiddenFor(model => model .AzureWebSitesDefaultDomainName )
102107 @Html.HiddenFor(model => model .ManagementEndpoint )
103108 @Html.HiddenFor(model => model .TokenAudience )
109+ @Html.HiddenFor(model => model .RunFromPackage )
110+
111+ <div class =" form-horizontal" >
112+ <hr />
113+
114+ @if (Model .RunFromPackage && string .IsNullOrEmpty (Environment .GetEnvironmentVariable (LetsEncrypt .Azure .Core .Models .AppSettingsAuthConfig .webRootPath )))
115+ {
116+ <div class =" alert alert-warning" role =" alert" >
117+ <p >Web Site was deployed using "Run From Package ", the site extension will have to configure a virtual application to ensure the challenge file can be browsable at http :// your-site/.well-known/acme-challenge. </p>
104118
105- < div class = " form-horizontal " >
106- < hr / >
107- @Html.ValidationSummary(true , " " , new { @class = " text-danger " } )
108- @{
109- var authModel = ( Model as LetsEncrypt . SiteExtension . Models . AuthenticationModel );
110- }
111- @if ( authModel != null && authModel . Error )
112- {
113- < div class = " alert alert-danger " role = " alert " >
114- @authModel.ErrorMessage
115- </ div >
116- }
117- < div class = " form-group " >
118- @Html.LabelFor(model = > model . Tenant , htmlAttributes : new { @ class = " control-label col-md-2 " } )
119- < div class = " col-md-10 " >
120- @Html.EditorFor(model = > model . Tenant , new { htmlAttributes = new { @ class = " form-control " } } )
121- @Html.ValidationMessageFor (model => model .Tenant , " " , new { @class = " text-danger " } )
122- </ div >
119+ < p > If you already host content under /. well - known then you should not continue , instead you should follow the manual setup procedure at < a href = " https : // github.com/sjkp/letsencrypt-siteextension/wiki/Run-From-Package">https://github.com/sjkp/letsencrypt-siteextension/wiki/Run-From-Package</a></p >
120+ </ div >
121+ }
122+ @Html . ValidationSummary ( true , "", new { @class = " text - danger " })
123+ @{
124+ var authModel = ( Model as LetsEncrypt . SiteExtension . Models . AuthenticationModel );
125+ }
126+ @if ( authModel != null && authModel . Error )
127+ {
128+ < div class = " alert alert-danger " role = " alert " >
129+ @authModel.ErrorMessage
130+ </ div >
131+ }
132+ < div class = " form-group " >
133+ @Html.LabelFor(model = > model . Tenant , htmlAttributes : new { @ class = " control-label col-md-2 " } )
134+ < div class = " col-md-10 " >
135+ @Html.EditorFor (model => model .Tenant , new { htmlAttributes = new { @class = " form-control " } } )
136+ @Html.ValidationMessageFor(model = > model . Tenant , " " , new { @class = " text-danger " } )
123137 </div >
138+ </div >
124139
125- <div class =" form-group" >
126- @Html.LabelFor(model => model .SubscriptionId , htmlAttributes : new { @class = " control-label col-md-2" } )
127- <div class =" col-md-10" >
128- @Html.EditorFor(model => model .SubscriptionId , new { htmlAttributes = new { @class = " form-control" } } )
129- @Html.ValidationMessageFor(model => model .SubscriptionId , " " , new { @class = " text-danger" } )
130- </div >
140+ <div class =" form-group" >
141+ @Html.LabelFor(model => model .SubscriptionId , htmlAttributes : new { @class = " control-label col-md-2" } )
142+ <div class =" col-md-10" >
143+ @Html.EditorFor(model => model .SubscriptionId , new { htmlAttributes = new { @class = " form-control" } } )
144+ @Html.ValidationMessageFor(model => model .SubscriptionId , " " , new { @class = " text-danger" } )
131145 </div >
146+ </div >
132147
133- <div class =" form-group" >
134- @Html.LabelFor(model => model .ClientId , htmlAttributes : new { @class = " control-label col-md-2" } )
135- <div class =" col-md-10" >
136- @Html.EditorFor(model => model .ClientId , new { htmlAttributes = new { @class = " form-control" } } )
137- @Html.ValidationMessageFor(model => model .ClientId , " " , new { @class = " text-danger" } )
138- </div >
148+ <div class =" form-group" >
149+ @Html.LabelFor(model => model .ClientId , htmlAttributes : new { @class = " control-label col-md-2" } )
150+ <div class =" col-md-10" >
151+ @Html.EditorFor(model => model .ClientId , new { htmlAttributes = new { @class = " form-control" } } )
152+ @Html.ValidationMessageFor(model => model .ClientId , " " , new { @class = " text-danger" } )
139153 </div >
154+ </div >
140155
141- <div class =" form-group" >
142- @Html.LabelFor(model => model .ClientSecret , htmlAttributes : new { @class = " control-label col-md-2" } )
143- <div class =" col-md-10" >
144- @Html.EditorFor(model => model .ClientSecret , new { htmlAttributes = new { @class = " form-control" } } )
145- @Html.ValidationMessageFor(model => model .ClientSecret , " " , new { @class = " text-danger" } )
146- </div >
156+ <div class =" form-group" >
157+ @Html.LabelFor(model => model .ClientSecret , htmlAttributes : new { @class = " control-label col-md-2" } )
158+ <div class =" col-md-10" >
159+ @Html.EditorFor(model => model .ClientSecret , new { htmlAttributes = new { @class = " form-control" } } )
160+ @Html.ValidationMessageFor(model => model .ClientSecret , " " , new { @class = " text-danger" } )
147161 </div >
162+ </div >
148163
149- <div class =" form-group" >
150- @Html.LabelFor(model => model .ResourceGroupName , htmlAttributes : new { @class = " control-label col-md-2" } )
151- <div class =" col-md-10" >
152- @Html.EditorFor(model => model .ResourceGroupName , new { htmlAttributes = new { @class = " form-control" } } )
153- @Html.ValidationMessageFor(model => model .ResourceGroupName , " " , new { @class = " text-danger" } )
154- </div >
164+ <div class =" form-group" >
165+ @Html.LabelFor(model => model .ResourceGroupName , htmlAttributes : new { @class = " control-label col-md-2" } )
166+ <div class =" col-md-10" >
167+ @Html.EditorFor(model => model .ResourceGroupName , new { htmlAttributes = new { @class = " form-control" } } )
168+ @Html.ValidationMessageFor(model => model .ResourceGroupName , " " , new { @class = " text-danger" } )
155169 </div >
170+ </div >
156171
157- <div class =" form-group" >
158- @Html.LabelFor(model => model .ServicePlanResourceGroupName , htmlAttributes : new { @class = " control-label col-md-2" } )
159- <div class =" col-md-10" >
160- @Html.EditorFor(model => model .ServicePlanResourceGroupName , new { htmlAttributes = new { @class = " form-control" } } )
161- @Html.ValidationMessageFor(model => model .ServicePlanResourceGroupName , " " , new { @class = " text-danger" } )
162- </div >
172+ <div class =" form-group" >
173+ @Html.LabelFor(model => model .ServicePlanResourceGroupName , htmlAttributes : new { @class = " control-label col-md-2" } )
174+ <div class =" col-md-10" >
175+ @Html.EditorFor(model => model .ServicePlanResourceGroupName , new { htmlAttributes = new { @class = " form-control" } } )
176+ @Html.ValidationMessageFor(model => model .ServicePlanResourceGroupName , " " , new { @class = " text-danger" } )
163177 </div >
164- < div class = " form-group " >
165- @Html.LabelFor(model = > model . UseIPBasedSSL , htmlAttributes : new { @ class = " control-label col-md-2 " } )
166- < div class = " col-md-10 " >
167- @Html.EditorFor(model = > model . UseIPBasedSSL , new { htmlAttributes = new { @ class = " form-control " } } )
168- @Html.ValidationMessageFor (model => model .UseIPBasedSSL , " " , new { @class = " text-danger " } )
169- </ div >
178+ </ div >
179+ < div class = " form-group " >
180+ @Html.LabelFor(model = > model . UseIPBasedSSL , htmlAttributes : new { @ class = " control-label col-md-2 " } )
181+ < div class = " col-md-10 " >
182+ @Html.EditorFor (model => model .UseIPBasedSSL , new { htmlAttributes = new { @class = " form-control " } } )
183+ @Html.ValidationMessageFor(model = > model . UseIPBasedSSL , " " , new { @class = " text-danger " } )
170184 </div >
185+ </div >
171186
172- <div class =" form-group" >
173- @Html.LabelFor(model => model .WebAppName , htmlAttributes : new { @class = " control-label col-md-2" } )
174- <div class =" col-md-10" >
175- @Html.EditorFor(model => model .WebAppName , new { htmlAttributes = new { @class = " form-control" , @readonly = " readonly" } } )
176- @Html.ValidationMessageFor(model => model .WebAppName , " " , new { @class = " text-danger" } )
177- </div >
178- </div >
179- <div class =" form-group" >
180- @Html.LabelFor(model => model .SiteSlotName , htmlAttributes : new { @class = " control-label col-md-2" } )
181- <div class =" col-md-10" >
182- @Html.EditorFor(model => model .SiteSlotName , new { htmlAttributes = new { @class = " form-control" } } )
183- @Html.ValidationMessageFor(model => model .SiteSlotName , " " , new { @class = " text-danger" } )
184- </div >
187+ <div class =" form-group" >
188+ @Html.LabelFor(model => model .WebAppName , htmlAttributes : new { @class = " control-label col-md-2" } )
189+ <div class =" col-md-10" >
190+ @Html.EditorFor(model => model .WebAppName , new { htmlAttributes = new { @class = " form-control" , @readonly = " readonly" } } )
191+ @Html.ValidationMessageFor(model => model .WebAppName , " " , new { @class = " text-danger" } )
185192 </div >
186- <div class =" form-group" >
187- @Html.LabelFor(model => model .UpdateAppSettings , htmlAttributes : new { @class = " control-label col-md-2" } )
188- <div class =" col-md-10" >
189- @Html.EditorFor(model => model .UpdateAppSettings , new { htmlAttributes = new { @class = " form-control" } } )
190- <span class =" text-danger" id =" showwarning" style =" display :none ;" >WARNING WEBSITE WILL RESTART .</span >
191- @Html.ValidationMessageFor(model => model .UpdateAppSettings , " " , new { @class = " text-danger" } )
192- </div >
193+ </div >
194+ <div class =" form-group" >
195+ @Html.LabelFor(model => model .SiteSlotName , htmlAttributes : new { @class = " control-label col-md-2" } )
196+ <div class =" col-md-10" >
197+ @Html.EditorFor(model => model .SiteSlotName , new { htmlAttributes = new { @class = " form-control" } } )
198+ @Html.ValidationMessageFor(model => model .SiteSlotName , " " , new { @class = " text-danger" } )
193199 </div >
194200 </div >
195- <div class =" form-horizontal" >
196- <input type =" submit" value =" Next" class =" btn btn-primary pull-right" />
197- <br />
198- <br />
201+ <div class =" form-group" >
202+ @Html.LabelFor(model => model .UpdateAppSettings , htmlAttributes : new { @class = " control-label col-md-2" } )
203+ <div class =" col-md-10" >
204+ @Html.EditorFor(model => model .UpdateAppSettings , new { htmlAttributes = new { @class = " form-control" } } )
205+ <span class =" text-danger" id =" showwarning" style =" display :none ;" >WARNING WEBSITE WILL RESTART .</span >
206+ @Html.ValidationMessageFor(model => model .UpdateAppSettings , " " , new { @class = " text-danger" } )
207+ </div >
199208 </div >
200- }
209+ </div >
210+ <div class =" form-horizontal" >
211+ <input type =" submit" value =" Next" class =" btn btn-primary pull-right" />
212+ <br />
213+ <br />
214+ </div >
215+ }
201216
202217<div >
203218</div >
204219@section scripts {
205- $(function () {
206- $('#UpdateAppSettings' ).change (function () {
207- if (this .checked )
208- {
209- $('#showwarning' ).show ();
210- } else {
211- $('#showwarning' ).hide ();
212- }
213- });
214- $('#automatedInstallHeader' ).click (function () {
215- $('#automatedInstall' ).toggle ();
216- });
217- });
218- }
220+ $(function () {
221+ $('#UpdateAppSettings' ).change (function () {
222+ if (this .checked )
223+ {
224+ $('#showwarning' ).show ();
225+ } else {
226+ $('#showwarning' ).hide ();
227+ }
228+ });
229+ $('#automatedInstallHeader' ).click (function () {
230+ $('#automatedInstall' ).toggle ();
231+ });
232+ });
233+ }
0 commit comments