private static void CreateNewDatabase(IAzure azure, string serverId) { try { ISqlDatabase tenantDatabase = azure.SqlServers.GetById(serverId).Databases .Define(TenantParameters.GetFormattedShortName) .Create(); MiscellaneousUtils.PrintDatabase(tenantDatabase); } catch (Exception ex) { throw ex; } }
private static void CreateNewDatabaseWithActiveDirectory(IAzure azure, string serverId) { try { IStorageAccount account = azure.StorageAccounts.GetById(TenantParameters.StorageAccountId); ISqlDatabase tenantDatabase = azure.SqlServers.GetById(serverId).Databases .Define(TenantParameters.GetFormattedShortName) .ImportFrom(account, TenantParameters.ContainerName, TenantParameters.TenantTemplateName) .WithActiveDirectoryLoginAndPassword(UserCredentials.UserName, UserCredentials.Password) .Create(); MiscellaneousUtils.PrintDatabase(tenantDatabase); } catch (Exception ex) { throw ex; } }