in code/Tools/Ops/ManageServerState/Program.cs [110:195]
public static async Task AsyncMain(string[] args)
{
ParseArgs(args);
var sr = new FileSettingsReader(ConfigurationManager.AppSettings["ConfigRelativePath"] + Path.DirectorySeparatorChar + environmentName + ".config");
var certThumbprint = sr.ReadValue(OBACertThumbprint);
var clientID = sr.ReadValue(OBAClientId);
var storeLocation = StoreLocation.CurrentUser;
var vaultUrl = sr.ReadValue(OBAVaultUrl);
ICertificateHelper cert = new CertificateHelper(certThumbprint, clientID, storeLocation);
IKeyVaultClient client = new AzureKeyVaultClient(cert);
var log = new Log(LogDestination.Debug, Log.DefaultCategoryName);
kv = new KV(log, clientID, vaultUrl, certThumbprint, storeLocation, client);
var kvReader = new KVSettingsReader(sr, kv);
if (doClean)
{
DisplayWarning();
}
// display current configuration
await ValidateAndPrintConfiguration(environmentName, kvReader);
if (forceOperation == false)
{
// get user approval
Console.Write("Are you sure you want to proceed? [y/n] : ");
ConsoleKeyInfo keyInfo = Console.ReadKey(false);
if (keyInfo.KeyChar != 'y')
{
return;
}
Console.WriteLine();
}
if (doAll || doTables)
{
string azureTableStorageConnectionString = await kvReader.ReadValueAsync("AzureStorageConnectionString");
if (doClean)
{
// Delete tables
await Tables.Clean(azureTableStorageConnectionString);
}
if (doCreate)
{
// Create tables
await Tables.Create(azureTableStorageConnectionString);
}
}
if (doAll || doQueues)
{
if (doClean)
{
// Delete queues
await Queues.Clean();
}
if (doCreate)
{
// Create queues
await Queues.Create();
}
}
if (doAll || doLogs)
{
string azureDiagnosticsConnectionString = await kvReader.ReadValueAsync("AzureStorageConnectionString");
if (doClean)
{
// Delete logs
await Logs.Clean(azureDiagnosticsConnectionString);
}
if (doCreate)
{
// Create queues
await Logs.Create();
}
}
Console.WriteLine("All done! Bye!");
}