public void TestSingleWebAppConfig() { m_appSettings[KeyPrefix + WebAppsKey] = WebApp1; m_renewer.Renew(); VerifySuccessfulRenewal(ExpectedFullRenewalParameters1); VerifySuccessfulRenewal(new[] { ExpectedFullRenewalParameters1 }, m_notificationRenewalParameterses); }
public async Task TestSingleWebAppConfig() { m_appSettings[KeyPrefix + WebAppsKey] = WebApp1; await m_renewer.Renew(); VerifySuccessfulRenewal(ExpectedFullRenewalParameters1); VerifySuccessfulNotification(ExpectedFullRenewalParameters1); }
private static int WebJobMain(string webjobName) { var startTicks = Environment.TickCount; Events.WebJobRenewalStarted(webjobName); Trace.TraceInformation("Web App SSL renewal job ({0}) started", webjobName); var renewr = new AppSettingsRenewer( new RenewalManager(), new AppSettingsRenewalParamsReader(new AppSettingsReader(ConfigurationManager.AppSettings, ConfigurationManager.ConnectionStrings)), new SendGridNotifier(ConfigurationManager.ConnectionStrings[Constants.KeyPrefix + Constants.SendGridApiKey]?.ConnectionString)); try { renewr.Renew().GetAwaiter().GetResult(); } catch (Exception e) when(!ExceptionHelper.IsCriticalException(e)) { Trace.TraceError("Unexpected exception: {0}", e); throw; // we want the webjob to fail } Events.WebjobRenewalCompleted(webjobName, startTicks); return(ExitCodes.Success); }
private static int WebJobMain(string webjobName) { var startTicks = Environment.TickCount; Events.WebJobRenewalStarted(webjobName); Console.WriteLine("Web App SSL renewal job ({0}) started", webjobName); var renewr = new AppSettingsRenewer( new RenewalManager(), new AppSettingsRenewalParamsReader(new AppSettingsReader(ConfigurationManager.AppSettings, ConfigurationManager.ConnectionStrings)), new SendGridNotifier(ConfigurationManager.ConnectionStrings[AppSettingsRenewalParamsReader.KeyPrefix + "SendGridApiKey"]?.ConnectionString)); try { renewr.Renew(); } catch (Exception e) when(!ExceptionHelper.IsCriticalException(e)) { Console.WriteLine("***ERROR*** Unexpected exception: {0}", e); throw; // we want the webjob to fail } Events.WebjobRenewalCompleted(webjobName, startTicks); return(Success); }
public async Task TestSharedSettings() { var appSettings = new NameValueCollection { { BuildConfigKey(WebAppsKey), WebApp3 }, { BuildConfigKey(SubscriptionIdKeySuffix), SubscriptionShared.ToString() }, { BuildConfigKey(ResourceGroupKeySuffix), ResourceGroupShared }, { BuildConfigKey(AzureDnsResourceGroupKeySuffix), ResourceGroupAzureDnsShared }, { BuildConfigKey(TenantIdKeySuffix), TenantShared }, { BuildConfigKey(HostsKeySuffix, WebApp3), String.Join(";", Hosts3) }, { BuildConfigKey(EmailKeySuffix), EmailShared }, { BuildConfigKey(FromEmailKeySuffix), FromEmailShared }, { BuildConfigKey(ClientIdKeySuffix), ClientIdShared.ToString() }, { BuildConfigKey(AzureDnsClientIdKeySuffix), ClientIdAzureDnsShared.ToString() }, { BuildConfigKey(UseIpBasedSslKeySuffix), UseIpBasedSslShared.ToString(CultureInfo.InvariantCulture) }, { BuildConfigKey(RsaKeyLengthKeySuffix), RsaKeyLengthShared.ToString(CultureInfo.InvariantCulture) }, { BuildConfigKey(AcmeBaseUriKeySuffix), AcmeBaseUriShared.ToString() }, { BuildConfigKey(WebRootPathKeySuffix), WebRootPathShared }, { BuildConfigKey(ServicePlanResourceGroupKeySuffix), ServicePlanResourceGroupShared }, { BuildConfigKey(AzureDnsZoneNameKeySuffix), AzureDnsZoneNameShared }, { BuildConfigKey(RenewXNumberOfDaysBeforeExpirationKeySuffix), RenewXNumberOfDaysBeforeExpirationShared.ToString(CultureInfo.InvariantCulture) }, { BuildConfigKey(AzureAuthenticationEndpointKeySuffix), AzureAuthenticationEndpointShared.ToString() }, { BuildConfigKey(AzureTokenAudienceKeySuffix), AzureTokenAudienceShared.ToString() }, { BuildConfigKey(AzureManagementEndpointKeySuffix), AzureManagementEndpointShared.ToString() }, { BuildConfigKey(AzureDefaultWebSiteDomainNameKeySuffix), AzureDefaultWebsiteDomainNameShared }, }; var connectionStrings = new ConnectionStringSettingsCollection { new ConnectionStringSettings(BuildConfigKey(ClientSecretKeySuffix), ClientSecretShared), }; var renewer = new AppSettingsRenewer( RenewalManager, new AppSettingsRenewalParamsReader(new AppSettingsReader(appSettings, connectionStrings)), EmailNotifier); await renewer.Renew().ConfigureAwait(false); VerifySuccessfulRenewal(ExpectedPartialRenewalParameters3); VerifySuccessfulNotification(ExpectedPartialRenewalParameters3); }