private void PrepareResource(AzureSQLDatabase resource) { var serverLogin = "******"; var serverPass = "******"; if (_sqlServer == null) { Console.WriteLine("Making sql server"); _sqlServer = _azure.SqlServers.Define(Guid.NewGuid().ToString("N").Substring(0, 16)) .WithRegion(ConfigProvider.GetValue("AzureRegion")) .WithExistingResourceGroup(_resourceGroup) .WithAdministratorLogin("sqladmin3423") .WithAdministratorPassword("myS3cureP@ssword") .WithNewFirewallRule("0.0.0.0", "255.255.255.255", "shady") .Create(); } Console.WriteLine("Making sql db: " + resource.Name); _databases.Add(resource, _sqlServer.Databases.Define(resource.Name) .WithEdition(resource.PerformanceTier).WithServiceObjective(resource.ServiceObjective) .Create()); PreparedResources.Add(resource); resource.ConnectionString = "Server=tcp:" + _sqlServer.Name + ".database.windows.net,1433;Initial Catalog=" + _databases[resource].Name + ";Persist Security Info=False;User ID=" + serverLogin + ";Password="******";MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"; Console.WriteLine("Done: " + resource.Name); }
private void PrepareResource(AzureTableStorage resource) { Console.WriteLine("Making AzureTableStorage: " + resource.Name); var storageAccount = _azure.StorageAccounts.Define(Guid.NewGuid().ToString("N").Substring(0, 16)) .WithRegion(_resourceGroup.RegionName) .WithExistingResourceGroup(_resourceGroup) .Create(); PreparedResources.Add(resource); _tableStorages.Add(resource, storageAccount); resource.ConnectionString = "DefaultEndpointsProtocol=https;AccountName=" + storageAccount.Name + ";AccountKey=" + storageAccount.GetKeys().First().Value + ";EndpointSuffix=core.windows.net"; Console.WriteLine("Done: " + resource.Name); }
private void PrepareResource(AzureServiceBusQueue resource) { Console.WriteLine("Making AzureServiceBusQueue: " + resource.Name); var queueName = resource.Name; var serviceBusNamespace = _azure.ServiceBusNamespaces .Define(SdkContext.RandomResourceName("namespace", 20)) .WithRegion(_resourceGroup.RegionName) .WithExistingResourceGroup(_resourceGroup) .WithNewQueue(queueName, resource.SizeInGB * 1024) .Create(); var firstQueue = serviceBusNamespace.Queues.GetByName(queueName); var rule = firstQueue.AuthorizationRules.Define("rulerule").WithManagementEnabled().Create(); resource.ConnectionString = rule.GetKeys().PrimaryConnectionString; Console.WriteLine("Making AzureServiceBusQueue: " + resource.Name); PreparedResources.Add(resource); _serviceQueues.Add(resource, firstQueue); Console.WriteLine("Done: " + resource.Name); }
private void PrepareResource(AzureAppService resource) { Init(); PricingTier tier = PricingTier.FreeF1; switch (resource.PerformanceTier) { case "FreeF1": tier = PricingTier.FreeF1; break; case "BasicB1": tier = PricingTier.BasicB1; break; case "BasicB2": tier = PricingTier.BasicB2; break; case "BasicB3": tier = PricingTier.BasicB3; break; case "PremiumP1": tier = PricingTier.PremiumP1; break; case "PremiumP2": tier = PricingTier.PremiumP2; break; case "PremiumP3": tier = PricingTier.PremiumP3; break; case "SharedD1": tier = PricingTier.SharedD1; break; case "StandardS1": tier = PricingTier.StandardS1; break; case "StandardS2": tier = PricingTier.StandardS2; break; case "StandardS3": tier = PricingTier.StandardS3; break; } Console.WriteLine("Making app service: " + resource.Name); var app = _azure.WebApps .Define(Guid.NewGuid().ToString("N").Substring(0, 8)) .WithRegion(ConfigProvider.GetValue("AzureRegion")) .WithExistingResourceGroup(_resourceGroup.Name) .WithNewWindowsPlan(tier) .Create(); PreparedResources.Add(resource); Console.WriteLine("Done: " + resource.Name); _webAppList.Add(resource, app); }