private void createManagedInstances(SqlManagementTestContext context, ResourceGroup resourceGroup, IList <string> managedInstanceNames) { SqlManagementClient sqlClient = context.GetClient <SqlManagementClient>(); Sku sku = new Sku(); sku.Name = "MIGP8G4"; sku.Tier = "GeneralPurpose"; VirtualNetwork vnet = ManagedInstanceTestFixture.CreateVirtualNetwork(context, resourceGroup, TestEnvironmentUtilities.DefaultLocationId); foreach (string miName in managedInstanceNames) { ManagedInstance managedInstance = sqlClient.ManagedInstances.CreateOrUpdate(resourceGroup.Name, miName, new ManagedInstance() { AdministratorLogin = SqlManagementTestUtilities.DefaultLogin, AdministratorLoginPassword = SqlManagementTestUtilities.DefaultPassword, SubnetId = vnet.Subnets[0].Id, Tags = new Dictionary <string, string>(), Location = TestEnvironmentUtilities.DefaultLocationId, Sku = sku, }); Assert.NotNull(managedInstance); } }
public ManagedInstanceTestFixture() { Context = new SqlManagementTestContext(this); try { SqlManagementClient sqlClient = Context.GetClient <SqlManagementClient>(); ResourceGroup = Context.CreateResourceGroup(); // Create vnet and get the subnet id VirtualNetwork vnet = CreateVirtualNetwork(Context, ResourceGroup, TestEnvironmentUtilities.DefaultLocationId); Sku sku = new Sku(); sku.Name = "MIGP8G4"; sku.Tier = "GeneralPurpose"; ManagedInstance = sqlClient.ManagedInstances.CreateOrUpdate(ResourceGroup.Name, "crud-tests-" + SqlManagementTestUtilities.GenerateName(), new ManagedInstance() { AdministratorLogin = SqlManagementTestUtilities.DefaultLogin, AdministratorLoginPassword = SqlManagementTestUtilities.DefaultPassword, Sku = sku, SubnetId = vnet.Subnets[0].Id, Tags = new Dictionary <string, string>(), Location = TestEnvironmentUtilities.DefaultLocationId, }); } catch (Exception ex) { Context.Dispose(); } }
public void FailoverReadableSecondaryInstance() { using (SqlManagementTestContext context = new SqlManagementTestContext(this)) { ResourceGroup resourceGroup = new ResourceGroup( TestEnvironmentUtilities.DefaultLocationId, name: "mibrkic"); SqlManagementClient sqlClient = context.GetClient <SqlManagementClient>(); string managedInstanceName = "sqlcl-failovertests-dotnetsdk1"; VirtualNetwork vnet = ManagedInstanceTestFixture.CreateVirtualNetwork(context, resourceGroup, TestEnvironmentUtilities.DefaultLocationId); Microsoft.Azure.Management.Sql.Models.Sku sku = new Microsoft.Azure.Management.Sql.Models.Sku { Name = "MIBC8G5", Tier = "BusinessCritical" }; ManagedInstance managedInstance = sqlClient.ManagedInstances.CreateOrUpdate(resourceGroup.Name, managedInstanceName + SqlManagementTestUtilities.GenerateName(methodName: "failover_readable_secondary"), new ManagedInstance() { AdministratorLogin = SqlManagementTestUtilities.DefaultLogin, AdministratorLoginPassword = SqlManagementTestUtilities.DefaultPassword, Sku = sku, SubnetId = vnet.Subnets[0].Id, Tags = new Dictionary <string, string>(), Location = TestEnvironmentUtilities.DefaultLocationId, }); Assert.NotNull(managedInstance); sqlClient.ManagedInstances.Failover(resourceGroup.Name, managedInstance.Name, ReplicaType.ReadableSecondary); } }
public void TestCreateGetDeleteVirtualCluster() { using (SqlManagementTestContext context = new SqlManagementTestContext(this)) { string resourceGroupName = "RG_MIPlayground"; SqlManagementClient sqlClient = context.GetClient <SqlManagementClient>(); string managedInstanceName = "sqlcl-vccrudtests-dotnetsdk1"; string login = "******"; string password = "******"; Dictionary <string, string> tags = new Dictionary <string, string>() { { "tagKey1", "TagValue1" } }; Microsoft.Azure.Management.Sql.Models.Sku sku = new Microsoft.Azure.Management.Sql.Models.Sku(); sku.Name = "MIGP8G4"; sku.Tier = "GeneralPurpose"; sku.Family = "Gen4"; string subnetId = "/subscriptions/a8c9a924-06c0-4bde-9788-e7b1370969e1/resourceGroups/RG_MIPlayground/providers/Microsoft.Network/virtualNetworks/VNET_MIPlayground/subnets/VCReservedSubnet"; string location = "eastus"; //Create server var managedInstance = sqlClient.ManagedInstances.CreateOrUpdate(resourceGroupName, managedInstanceName, new ManagedInstance() { AdministratorLogin = login, AdministratorLoginPassword = password, Sku = sku, SubnetId = subnetId, Tags = tags, Location = location, }); SqlManagementTestUtilities.ValidateManagedInstance(managedInstance, managedInstanceName, login, tags, location); // Get and verify Virtual cluster var virtualClusters = sqlClient.VirtualClusters.List(); Assert.True(virtualClusters.Count() > 0); var virtualCluster = virtualClusters.Single(vc => vc.SubnetId == subnetId); Assert.Equal(location, virtualCluster.Location, ignoreCase: true); string virtualClusterName = virtualCluster.Name; virtualCluster = sqlClient.VirtualClusters.ListByResourceGroup(resourceGroupName).Single(vc => vc.SubnetId == subnetId); Assert.Equal(location, virtualCluster.Location, ignoreCase: true); Assert.Equal(virtualClusterName, virtualCluster.Name); virtualCluster = sqlClient.VirtualClusters.Get(resourceGroupName, virtualClusterName); Assert.Equal(location, virtualCluster.Location, ignoreCase: true); Assert.Equal(virtualClusterName, virtualCluster.Name); Assert.Equal(subnetId, virtualCluster.SubnetId); // Drop managed server sqlClient.ManagedInstances.Delete(resourceGroupName, managedInstanceName); // Delete Virtual Cluster sqlClient.VirtualClusters.Delete(resourceGroupName, virtualClusterName); Assert.Throws <Microsoft.Rest.Azure.CloudException>(() => sqlClient.VirtualClusters.Get(resourceGroupName, virtualClusterName)); } }
public void TestSetManagedInstanceActiveDirectoryAdministrator() { string aadAdmin = "aadadmin"; string managedInstanceName = "miaadadmin"; using (SqlManagementTestContext context = new SqlManagementTestContext(this)) { Guid objectId = new Guid(TestEnvironmentUtilities.GetUserObjectId()); Guid tenantId = new Guid(TestEnvironmentUtilities.GetTenantId()); SqlManagementClient sqlClient = context.GetClient <SqlManagementClient>(); ResourceGroup resourceGroup = context.CreateResourceGroup(); // Create vnet and get the subnet id VirtualNetwork vnet = ManagedInstanceTestFixture.CreateVirtualNetwork(context, resourceGroup, TestEnvironmentUtilities.DefaultLocationId); Sku sku = new Sku(); sku.Name = "MIGP8G4"; sku.Tier = "GeneralPurpose"; ManagedInstance instance = sqlClient.ManagedInstances.CreateOrUpdate(resourceGroup.Name, "crud-tests-" + managedInstanceName, new ManagedInstance() { AdministratorLogin = SqlManagementTestUtilities.DefaultLogin, AdministratorLoginPassword = SqlManagementTestUtilities.DefaultPassword, Sku = sku, SubnetId = vnet.Subnets[0].Id, Tags = new Dictionary <string, string>(), Location = TestEnvironmentUtilities.DefaultLocationId, }); Assert.NotNull(instance); // Add new Active Directory Admin ManagedInstanceAdministrator newAdmin = new ManagedInstanceAdministrator(login: aadAdmin, sid: objectId, tenantId: tenantId); ManagedInstanceAdministrator createResult = sqlClient.ManagedInstanceAdministrators.CreateOrUpdate(resourceGroup.Name, instance.Name, newAdmin); Assert.Equal(aadAdmin, createResult.Login); // Get the current Active Directory Admin ManagedInstanceAdministrator getResult = sqlClient.ManagedInstanceAdministrators.Get(resourceGroup.Name, instance.Name); Assert.Equal(aadAdmin, getResult.Login); Assert.Equal(objectId, getResult.Sid); Assert.Equal(tenantId, getResult.TenantId); // Delete the Active Directory Admin on server sqlClient.ManagedInstanceAdministrators.Delete(resourceGroup.Name, instance.Name); // List all Active Directory Admins for isntance. Microsoft.Azure.Management.Sql.Models.Page1 <ManagedInstanceAdministrator> admins = (Microsoft.Azure.Management.Sql.Models.Page1 <ManagedInstanceAdministrator>)sqlClient.ManagedInstanceAdministrators.ListByInstance(resourceGroup.Name, instance.Name); Assert.True(admins == null || !admins.GetEnumerator().MoveNext()); } }
private ManagedInstance CreateManagedInstance(SqlManagementTestContext context, SqlManagementClient sqlClient, ResourceGroup resourceGroup, string callingMethodName = "CreateManagedInstance") { // Create vnet and get the subnet id VirtualNetwork vnet = ManagedInstanceTestFixture.CreateVirtualNetwork(context, resourceGroup, TestEnvironmentUtilities.DefaultLocationId); Sku sku = new Sku(); sku.Name = "MIGP8G4"; sku.Tier = "GeneralPurpose"; ManagedInstance managedInstance = sqlClient.ManagedInstances.CreateOrUpdate(resourceGroup.Name, _testPrefix + SqlManagementTestUtilities.GenerateName(methodName: callingMethodName), new ManagedInstance() { AdministratorLogin = SqlManagementTestUtilities.DefaultLogin, AdministratorLoginPassword = SqlManagementTestUtilities.DefaultPassword, Sku = sku, SubnetId = vnet.Subnets[0].Id, Tags = new Dictionary <string, string>(), Location = TestEnvironmentUtilities.DefaultLocationId, }); return(managedInstance); }
public ManagedInstance CreateManagedInstance(ResourceGroup resourceGroup, string location) { SqlManagementClient sqlClient = GetClient <SqlManagementClient>(); string miName = "crud-tests-" + SqlManagementTestUtilities.GenerateName(); Dictionary <string, string> tags = new Dictionary <string, string>(); string subnetId = "/subscriptions/a8c9a924-06c0-4bde-9788-e7b1370969e1/resourceGroups/RG_MIPlayground/providers/Microsoft.Network/virtualNetworks/VNET_MIPlayground/subnets/MISubnet"; Microsoft.Azure.Management.Sql.Models.Sku sku = new Microsoft.Azure.Management.Sql.Models.Sku(name: "CLS3", tier: "Standard"); var managedInstance = sqlClient.ManagedInstances.CreateOrUpdate(resourceGroup.Name, miName, new ManagedInstance() { AdministratorLogin = SqlManagementTestUtilities.DefaultLogin, AdministratorLoginPassword = SqlManagementTestUtilities.DefaultPassword, Sku = sku, SubnetId = subnetId, Tags = tags, Location = location, }); SqlManagementTestUtilities.ValidateManagedInstance(managedInstance, miName, SqlManagementTestUtilities.DefaultLogin, tags, location); return(managedInstance); }
public void TestCreateUpdateGetDropManagedInstance() { using (SqlManagementTestContext context = new SqlManagementTestContext(this)) { ResourceGroup resourceGroup = context.CreateResourceGroup(); SqlManagementClient sqlClient = context.GetClient <SqlManagementClient>(); string managedInstanceName = "sqlcl-crudtestswithdnszone-dotnetsdk1"; string login = "******"; string password = "******"; Dictionary <string, string> tags = new Dictionary <string, string>() { { "tagKey1", "TagValue1" } }; Microsoft.Azure.Management.Sql.Models.Sku sku = new Microsoft.Azure.Management.Sql.Models.Sku(); sku.Name = "MIGP8G4"; sku.Tier = "GeneralPurpose"; string subnetId = "/subscriptions/a8c9a924-06c0-4bde-9788-e7b1370969e1/resourceGroups/StdjordjTestResourceGroup/providers/Microsoft.Network/virtualNetworks/ZiwaVirtualNetwork4/subnets/default"; string location = "westcentralus"; //Create server var managedInstance1 = sqlClient.ManagedInstances.CreateOrUpdate(resourceGroup.Name, managedInstanceName, new ManagedInstance() { AdministratorLogin = login, AdministratorLoginPassword = password, Sku = sku, SubnetId = subnetId, Tags = tags, Location = location, }); SqlManagementTestUtilities.ValidateManagedInstance(managedInstance1, managedInstanceName, login, tags, TestEnvironmentUtilities.DefaultLocationId); // Create second server string managedInstanceName2 = "sqlcl-crudtestswithdnszone-dotnetsdk2"; var managedInstance2 = sqlClient.ManagedInstances.CreateOrUpdate(resourceGroup.Name, managedInstanceName2, new ManagedInstance() { AdministratorLogin = login, AdministratorLoginPassword = password, Sku = sku, SubnetId = subnetId, Tags = tags, Location = location, DnsZonePartner = string.Format("/subscriptions/a8c9a924-06c0-4bde-9788-e7b1370969e1/resourceGroups/{0}/providers/Microsoft.Sql/managedInstances/sqlcl-crudtestswithdnszone-dotnetsdk1", resourceGroup.Name) }); SqlManagementTestUtilities.ValidateManagedInstance(managedInstance2, managedInstanceName2, login, tags, TestEnvironmentUtilities.DefaultLocationId); // Get first server var getMI1 = sqlClient.ManagedInstances.Get(resourceGroup.Name, managedInstanceName); SqlManagementTestUtilities.ValidateManagedInstance(getMI1, managedInstanceName, login, tags, TestEnvironmentUtilities.DefaultLocationId); // Get second server var getMI2 = sqlClient.ManagedInstances.Get(resourceGroup.Name, managedInstanceName2); SqlManagementTestUtilities.ValidateManagedInstance(getMI2, managedInstanceName2, login, tags, TestEnvironmentUtilities.DefaultLocationId); // Verify that dns zone value is correctly inherited from dns zone partner Assert.Equal(getMI1.DnsZone, getMI2.DnsZone); var listMI = sqlClient.ManagedInstances.ListByResourceGroup(resourceGroup.Name); Assert.Equal(2, listMI.Count()); // Update first server Dictionary <string, string> newTags = new Dictionary <string, string>() { { "asdf", "zxcv" } }; var updateMI1 = sqlClient.ManagedInstances.Update(resourceGroup.Name, managedInstanceName, new ManagedInstanceUpdate { Tags = newTags }); SqlManagementTestUtilities.ValidateManagedInstance(updateMI1, managedInstanceName, login, newTags, TestEnvironmentUtilities.DefaultLocationId); // Drop server, update count sqlClient.ManagedInstances.DeleteAsync(resourceGroup.Name, managedInstanceName); var listMI2 = sqlClient.ManagedInstances.ListByResourceGroup(resourceGroup.Name); Assert.Equal(1, listMI2.Count()); sqlClient.ManagedInstances.DeleteAsync(resourceGroup.Name, managedInstanceName2); var listMI3 = sqlClient.ManagedInstances.ListByResourceGroup(resourceGroup.Name); Assert.Empty(listMI3); } }
public void TestCreateUpdateGetDropManagedInstance() { using (SqlManagementTestContext context = new SqlManagementTestContext(this)) { ResourceGroup resourceGroup = context.CreateResourceGroup(); SqlManagementClient sqlClient = context.GetClient <SqlManagementClient>(); Random r = new Random(); string managedInstanceName = "sqlcl-crudtestswithdnszone-dotnetsdk1"; string login = "******"; string password = "******"; Dictionary <string, string> tags = new Dictionary <string, string>() { { "tagKey1", "TagValue1" } }; Microsoft.Azure.Management.Sql.Models.Sku sku = new Microsoft.Azure.Management.Sql.Models.Sku(); sku.Name = "MIGP8G4"; sku.Tier = "GeneralPurpose"; sku.Family = "Gen5"; string subnetId = "/subscriptions/a8c9a924-06c0-4bde-9788-e7b1370969e1/resourceGroups/v-urmila/providers/Microsoft.Network/virtualNetworks/MIVirtualNetwork/subnets/ManagedInsanceSubnet"; string location = "westeurope"; bool publicDataEndpointEnabled = true; string proxyOverride = ManagedInstanceProxyOverride.Proxy; //Create server var managedInstance1 = sqlClient.ManagedInstances.CreateOrUpdate(resourceGroup.Name, managedInstanceName, new ManagedInstance() { AdministratorLogin = login, AdministratorLoginPassword = password, Sku = sku, SubnetId = subnetId, Tags = tags, Location = location, }); SqlManagementTestUtilities.ValidateManagedInstance(managedInstance1, managedInstanceName, login, tags, TestEnvironmentUtilities.DefaultLocationId, shouldCheckState: true); // Create second server string managedInstanceName2 = "sqlcl-crudtestswithdnszone-dotnetsdk2"; var managedInstance2 = sqlClient.ManagedInstances.CreateOrUpdate(resourceGroup.Name, managedInstanceName2, new ManagedInstance() { AdministratorLogin = login, AdministratorLoginPassword = password, Sku = sku, SubnetId = subnetId, Tags = tags, Location = location, DnsZonePartner = string.Format("/subscriptions/a8c9a924-06c0-4bde-9788-e7b1370969e1/resourceGroups/{0}/providers/Microsoft.Sql/managedInstances/{1}", resourceGroup.Name, managedInstanceName), PublicDataEndpointEnabled = publicDataEndpointEnabled, ProxyOverride = proxyOverride }); SqlManagementTestUtilities.ValidateManagedInstance(managedInstance2, managedInstanceName2, login, tags, TestEnvironmentUtilities.DefaultLocationId, shouldCheckState: true); // Get first server var getMI1 = sqlClient.ManagedInstances.Get(resourceGroup.Name, managedInstanceName); SqlManagementTestUtilities.ValidateManagedInstance(getMI1, managedInstanceName, login, tags, TestEnvironmentUtilities.DefaultLocationId, shouldCheckState: true); // Get second server var getMI2 = sqlClient.ManagedInstances.Get(resourceGroup.Name, managedInstanceName2); SqlManagementTestUtilities.ValidateManagedInstance(getMI2, managedInstanceName2, login, tags, TestEnvironmentUtilities.DefaultLocationId, shouldCheckState: true); // Verify that dns zone value is correctly inherited from dns zone partner Assert.Equal(getMI1.DnsZone, getMI2.DnsZone); // Verify PublicDataEndpointEnabled value for second server Assert.Equal(publicDataEndpointEnabled, getMI2.PublicDataEndpointEnabled); // Verify ProxyOverride value for second server Assert.Equal(proxyOverride, getMI2.ProxyOverride); var listMI = sqlClient.ManagedInstances.ListByResourceGroup(resourceGroup.Name); Assert.Equal(2, listMI.Count()); // Update first server Dictionary <string, string> newTags = new Dictionary <string, string>() { { "asdf", "zxcv" } }; var updateMI1 = sqlClient.ManagedInstances.Update(resourceGroup.Name, managedInstanceName, new ManagedInstanceUpdate { Tags = newTags, LicenseType = "LicenseIncluded" }); SqlManagementTestUtilities.ValidateManagedInstance(updateMI1, managedInstanceName, login, newTags, TestEnvironmentUtilities.DefaultLocationId); // Drop server, update count sqlClient.ManagedInstances.DeleteAsync(resourceGroup.Name, managedInstanceName).ConfigureAwait(true); var listMI2 = sqlClient.ManagedInstances.ListByResourceGroup(resourceGroup.Name); Assert.Equal(1, listMI2.Count()); sqlClient.ManagedInstances.DeleteAsync(resourceGroup.Name, managedInstanceName2).ConfigureAwait(true); var listMI3 = sqlClient.ManagedInstances.ListByResourceGroup(resourceGroup.Name); Assert.Empty(listMI3); } }
public void TestCancelManagedInstanceOperation() { using (SqlManagementTestContext context = new SqlManagementTestContext(this)) { SqlManagementClient sqlClient = context.GetClient <SqlManagementClient>(); string managedInstanceName = "v-urmila-mi-test"; string resourceGroup = "v-urmila"; Microsoft.Azure.Management.Sql.Models.Sku sku = new Microsoft.Azure.Management.Sql.Models.Sku(); sku.Name = "MIGP4G5"; sku.Tier = "GeneralPurpose"; sku.Family = "Gen5"; var managedInstance = sqlClient.ManagedInstances.Get(resourceGroup, managedInstanceName); // Old operations should be excluded from validation. var managedInstanceOperations = sqlClient.ManagedInstanceOperations.ListByManagedInstance(resourceGroup, managedInstanceName); int oldOperations = managedInstanceOperations.Count(); // Sync update managed server. sqlClient.ManagedInstances.Update(resourceGroup, managedInstanceName, new ManagedInstanceUpdate { StorageSizeInGB = 128 }); managedInstanceOperations = sqlClient.ManagedInstanceOperations.ListByManagedInstance(resourceGroup, managedInstanceName); var operationId = managedInstanceOperations.ElementAt(oldOperations).Name; var firstManagedInstanceOperation = sqlClient.ManagedInstanceOperations.Get(resourceGroup, managedInstanceName, System.Guid.Parse(operationId)); // Validate that operation finished successfully. SqlManagementTestUtilities.ValidateManagedInstanceOperation(firstManagedInstanceOperation, operationId, "UPDATE MANAGED SERVER", 100, "Succeeded", false); // Async update server var updateManagedInstance = sqlClient.ManagedInstances.UpdateAsync(resourceGroup, managedInstanceName, new ManagedInstanceUpdate { VCores = 16 }); do { managedInstanceOperations = sqlClient.ManagedInstanceOperations.ListByManagedInstance(resourceGroup, managedInstanceName); Thread.Sleep(20000); } while (managedInstanceOperations.Count() < oldOperations + 2 || !managedInstanceOperations.ElementAt(oldOperations + 1).IsCancellable.Value); operationId = managedInstanceOperations.ElementAt(oldOperations + 1).Name; // Initiate cancel of second update which is in progress. sqlClient.ManagedInstanceOperations.Cancel(resourceGroup, managedInstanceName, System.Guid.Parse(operationId)); var secondManagedInstanceOperation = sqlClient.ManagedInstanceOperations.Get(resourceGroup, managedInstanceName, System.Guid.Parse(operationId)); while (!secondManagedInstanceOperation.State.Equals("Cancelled")) { secondManagedInstanceOperation = sqlClient.ManagedInstanceOperations.Get(resourceGroup, managedInstanceName, System.Guid.Parse(operationId)); Thread.Sleep(20000); } // Validate that operation was cancelled. SqlManagementTestUtilities.ValidateManagedInstanceOperation(secondManagedInstanceOperation, operationId, "UPDATE MANAGED SERVER", 100, "Cancelled", false); } }
public void ShortTermRetentionOnDroppedDatabase() { string testPrefix = "manageddatabaserestorescenariotest-"; using (SqlManagementTestContext Context = new SqlManagementTestContext(this)) { SqlManagementClient sqlClient = Context.GetClient <SqlManagementClient>(); ResourceGroup resourceGroup = Context.CreateResourceGroup(); // Create vnet and get the subnet id VirtualNetwork vnet = ManagedInstanceTestFixture.CreateVirtualNetwork(Context, resourceGroup, TestEnvironmentUtilities.DefaultLocationId); Sku sku = new Sku(); sku.Name = "MIGP8G4"; sku.Tier = "GeneralPurpose"; ManagedInstance managedInstance = sqlClient.ManagedInstances.CreateOrUpdate(resourceGroup.Name, testPrefix + SqlManagementTestUtilities.GenerateName(), new ManagedInstance() { AdministratorLogin = SqlManagementTestUtilities.DefaultLogin, AdministratorLoginPassword = SqlManagementTestUtilities.DefaultPassword, Sku = sku, SubnetId = vnet.Subnets[0].Id, Tags = new Dictionary <string, string>(), Location = TestEnvironmentUtilities.DefaultLocationId, }); // Create managed database // string dbName = SqlManagementTestUtilities.GenerateName(testPrefix); var db1 = sqlClient.ManagedDatabases.CreateOrUpdate(resourceGroup.Name, managedInstance.Name, dbName, new ManagedDatabase() { Location = managedInstance.Location, }); Assert.NotNull(db1); int startingRetention = 25; int invalidValue = 35; int validValue = 20; // Attempt to increase retention period to 25 days and verfiy that the operation succeeded. Since increasing of retention days for dropped database is disabled, // we need to increase retention beforehand, and test reducing it once database is dropped. ManagedBackupShortTermRetentionPolicy parameters0 = new ManagedBackupShortTermRetentionPolicy(retentionDays: startingRetention); sqlClient.ManagedBackupShortTermRetentionPolicies.CreateOrUpdateWithHttpMessagesAsync(resourceGroup.Name, managedInstance.Name, dbName, parameters0); Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities.Wait(TimeSpan.FromSeconds(3)); ManagedBackupShortTermRetentionPolicy policy = sqlClient.ManagedBackupShortTermRetentionPolicies.Get(resourceGroup.Name, managedInstance.Name, dbName); Assert.Equal(startingRetention, policy.RetentionDays); // We need to wait for database to create its first backup. Currently if database drops too quickly it won't be restorable. // This will be changed in couple of weeks, howerver since building up Managed Instance takes over 60mins, this wait isn't not be a problem. // No need to sleep if we are playing back the recording. if (HttpMockServer.Mode == HttpRecorderMode.Record) { Thread.Sleep(TimeSpan.FromMinutes(10)); } // Delete the original database sqlClient.ManagedDatabases.Delete(resourceGroup.Name, managedInstance.Name, db1.Name); // Wait until the final backup is created and the restorable dropped database exists. // This could be up to 10 minutes after the database is deleted, and the database must already // have a backup (which was accomplished by the previous wait period). Let's wait up to 15 // just to give it a little more room. IEnumerable <RestorableDroppedManagedDatabase> droppedDatabases; DateTime startTime = DateTime.UtcNow; TimeSpan timeout = TimeSpan.FromMinutes(15); do { droppedDatabases = sqlClient.RestorableDroppedManagedDatabases.ListByInstance(resourceGroup.Name, managedInstance.Name); if (droppedDatabases.Any()) { // Dropped database now exists. Exit polling loop. break; } // Sleep if we are running live to avoid hammering the server. // No need to sleep if we are playing back the recording. if (HttpMockServer.Mode == HttpRecorderMode.Record) { Thread.Sleep(TimeSpan.FromSeconds(30)); } } while (DateTime.UtcNow < startTime + timeout); // Assert that we found a restorable db before timeout ended. Assert.True(droppedDatabases.Any(), "No dropped databases were found after waiting for " + timeout); var rdmd = droppedDatabases.Single(); // Attempt to increase retention period to 3 days and verfiy that the operation fails. ManagedBackupShortTermRetentionPolicy parameters1 = new ManagedBackupShortTermRetentionPolicy(retentionDays: invalidValue); sqlClient.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies.CreateOrUpdateWithHttpMessagesAsync(resourceGroup.Name, managedInstance.Name, rdmd.Name, parameters1); Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities.Wait(TimeSpan.FromSeconds(3)); policy = sqlClient.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies.Get(resourceGroup.Name, managedInstance.Name, rdmd.Name); Assert.Equal(startingRetention, policy.RetentionDays); // Attempt to increase retention period to 20 days and verfiy that the operation succeeded . ManagedBackupShortTermRetentionPolicy parameters2 = new ManagedBackupShortTermRetentionPolicy(retentionDays: validValue); sqlClient.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies.CreateOrUpdateWithHttpMessagesAsync(resourceGroup.Name, managedInstance.Name, rdmd.Name, parameters2); Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities.Wait(TimeSpan.FromSeconds(3)); policy = sqlClient.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies.Get(resourceGroup.Name, managedInstance.Name, rdmd.Name); Assert.Equal(validValue, policy.RetentionDays); } }
public void ShortTermRetentionOnLiveDatabase() { string testPrefix = "manageddatabaserestorescenariotest-"; using (SqlManagementTestContext Context = new SqlManagementTestContext(this)) { SqlManagementClient sqlClient = Context.GetClient <SqlManagementClient>(); ResourceGroup resourceGroup = Context.CreateResourceGroup(); // Create vnet and get the subnet id VirtualNetwork vnet = ManagedInstanceTestFixture.CreateVirtualNetwork(Context, resourceGroup, TestEnvironmentUtilities.DefaultLocationId); Sku sku = new Sku(); sku.Name = "MIGP8G4"; sku.Tier = "GeneralPurpose"; ManagedInstance managedInstance = sqlClient.ManagedInstances.CreateOrUpdate(resourceGroup.Name, testPrefix + SqlManagementTestUtilities.GenerateName(), new ManagedInstance() { AdministratorLogin = SqlManagementTestUtilities.DefaultLogin, AdministratorLoginPassword = SqlManagementTestUtilities.DefaultPassword, Sku = sku, SubnetId = vnet.Subnets[0].Id, Tags = new Dictionary <string, string>(), Location = TestEnvironmentUtilities.DefaultLocationId, }); // Create managed database // string dbName = SqlManagementTestUtilities.GenerateName(testPrefix); var db1 = sqlClient.ManagedDatabases.CreateOrUpdate(resourceGroup.Name, managedInstance.Name, dbName, new ManagedDatabase() { Location = managedInstance.Location, }); Assert.NotNull(db1); int basicRetention = 7; int invalidValue = 3; int validValue = 20; // Attempt to increase retention period to 7 days and verfiy that the operation succeeded. ManagedBackupShortTermRetentionPolicy parameters0 = new ManagedBackupShortTermRetentionPolicy(retentionDays: basicRetention); sqlClient.ManagedBackupShortTermRetentionPolicies.CreateOrUpdateWithHttpMessagesAsync(resourceGroup.Name, managedInstance.Name, dbName, parameters0); Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities.Wait(TimeSpan.FromSeconds(3)); ManagedBackupShortTermRetentionPolicy policy = sqlClient.ManagedBackupShortTermRetentionPolicies.Get(resourceGroup.Name, managedInstance.Name, dbName); Assert.Equal(basicRetention, policy.RetentionDays); // Attempt to increase retention period to 3 days and verfiy that the operation fails. ManagedBackupShortTermRetentionPolicy parameters1 = new ManagedBackupShortTermRetentionPolicy(retentionDays: invalidValue); sqlClient.ManagedBackupShortTermRetentionPolicies.CreateOrUpdateWithHttpMessagesAsync(resourceGroup.Name, managedInstance.Name, dbName, parameters1); Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities.Wait(TimeSpan.FromSeconds(3)); policy = sqlClient.ManagedBackupShortTermRetentionPolicies.Get(resourceGroup.Name, managedInstance.Name, dbName); Assert.Equal(basicRetention, policy.RetentionDays); // Attempt to increase retention period to 20 days and verfiy that the operation succeeded . ManagedBackupShortTermRetentionPolicy parameters2 = new ManagedBackupShortTermRetentionPolicy(retentionDays: validValue); sqlClient.ManagedBackupShortTermRetentionPolicies.CreateOrUpdateWithHttpMessagesAsync(resourceGroup.Name, managedInstance.Name, dbName, parameters2); Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities.Wait(TimeSpan.FromSeconds(3)); policy = sqlClient.ManagedBackupShortTermRetentionPolicies.Get(resourceGroup.Name, managedInstance.Name, dbName); Assert.Equal(validValue, policy.RetentionDays); } }
public void RestorableDroppedManagedDatabasesTests() { string testPrefix = "manageddatabaserestorescenariotest-"; using (SqlManagementTestContext Context = new SqlManagementTestContext(this)) { SqlManagementClient sqlClient = Context.GetClient <SqlManagementClient>(); ResourceGroup resourceGroup = Context.CreateResourceGroup(); // Create vnet and get the subnet id VirtualNetwork vnet = ManagedInstanceTestFixture.CreateVirtualNetwork(Context, resourceGroup, TestEnvironmentUtilities.DefaultLocationId); Sku sku = new Sku(); sku.Name = "MIGP8G4"; sku.Tier = "GeneralPurpose"; ManagedInstance managedInstance = sqlClient.ManagedInstances.CreateOrUpdate(resourceGroup.Name, testPrefix + SqlManagementTestUtilities.GenerateName(), new ManagedInstance() { AdministratorLogin = SqlManagementTestUtilities.DefaultLogin, AdministratorLoginPassword = SqlManagementTestUtilities.DefaultPassword, Sku = sku, SubnetId = vnet.Subnets[0].Id, Tags = new Dictionary <string, string>(), Location = TestEnvironmentUtilities.DefaultLocationId, }); // Create managed database // string dbName = SqlManagementTestUtilities.GenerateName(testPrefix); var db1 = sqlClient.ManagedDatabases.CreateOrUpdate(resourceGroup.Name, managedInstance.Name, dbName, new ManagedDatabase() { Location = managedInstance.Location, }); Assert.NotNull(db1); // We need to wait for database to create its first backup. Currently if database drops too quickly it won't be restorable. // This will be changed in couple of weeks, howerver since building up Managed Instance takes over 60mins, this wait isn't not be a problem. // No need to sleep if we are playing back the recording. if (HttpMockServer.Mode == HttpRecorderMode.Record) { Thread.Sleep(TimeSpan.FromMinutes(10)); } // Delete the original database sqlClient.ManagedDatabases.Delete(resourceGroup.Name, managedInstance.Name, db1.Name); // Wait until the final backup is created and the restorable dropped database exists. // This could be up to 10 minutes after the database is deleted, and the database must already // have a backup (which was accomplished by the previous wait period). Let's wait up to 15 // just to give it a little more room. IEnumerable <RestorableDroppedManagedDatabase> droppedDatabases; DateTime startTime = DateTime.UtcNow; TimeSpan timeout = TimeSpan.FromMinutes(15); do { droppedDatabases = sqlClient.RestorableDroppedManagedDatabases.ListByInstance(resourceGroup.Name, managedInstance.Name); if (droppedDatabases.Any()) { // Dropped database now exists. Exit polling loop. break; } // Sleep if we are running live to avoid hammering the server. // No need to sleep if we are playing back the recording. if (HttpMockServer.Mode == HttpRecorderMode.Record) { Thread.Sleep(TimeSpan.FromSeconds(30)); } } while (DateTime.UtcNow < startTime + timeout); // Assert that we found a restorable db before timeout ended. Assert.True(droppedDatabases.Any(), "No dropped databases were found after waiting for " + timeout); // The original database should now exist as a restorable dropped database var droppedDatabase = droppedDatabases.Single(); Assert.StartsWith(db1.Name, droppedDatabase.Name); Assert.True(droppedDatabases.Count() == 1); // Test single get var getDroppedDatabase = sqlClient.RestorableDroppedManagedDatabases.Get(resourceGroup.Name, managedInstance.Name, droppedDatabase.Name); Assert.StartsWith(getDroppedDatabase.Name, droppedDatabase.Name); // Create another managed database // dbName = SqlManagementTestUtilities.GenerateName(testPrefix); var db2 = sqlClient.ManagedDatabases.CreateOrUpdate(resourceGroup.Name, managedInstance.Name, dbName, new ManagedDatabase() { Location = managedInstance.Location, }); Assert.NotNull(db2); // We need to wait for database to create its first backup. Currently if database drops too quickly it won't be restorable. // This will be changed in couple of weeks, howerver since building up Managed Instance takes over 60mins, this wait isn't not be a problem. // No need to sleep if we are playing back the recording. if (HttpMockServer.Mode == HttpRecorderMode.Record) { Thread.Sleep(TimeSpan.FromMinutes(10)); } // Delete the original database sqlClient.ManagedDatabases.Delete(resourceGroup.Name, managedInstance.Name, db2.Name); // Wait until the final backup is created and the restorable dropped database exists. // This could be up to 10 minutes after the database is deleted, and the database must already // have a backup (which was accomplished by the previous wait period). Let's wait up to 15 // just to give it a little more room. do { droppedDatabases = sqlClient.RestorableDroppedManagedDatabases.ListByInstance(resourceGroup.Name, managedInstance.Name); if (droppedDatabases.Any()) { // Dropped database now exists. Exit polling loop. break; } // Sleep if we are running live to avoid hammering the server. // No need to sleep if we are playing back the recording. if (HttpMockServer.Mode == HttpRecorderMode.Record) { Thread.Sleep(TimeSpan.FromSeconds(30)); } } while (DateTime.UtcNow < startTime + timeout); // There should be 2 dropped databases now Assert.True(droppedDatabases.Count() == 2); } }
/// <summary> /// Initializes a new instance of the Database class. /// </summary> /// <param name="location">Resource location.</param> /// <param name="id">Resource ID.</param> /// <param name="name">Resource name.</param> /// <param name="type">Resource type.</param> /// <param name="tags">Resource tags.</param> /// <param name="sku">The database SKU. /// /// The list of SKUs may vary by region and support offer. To determine /// the SKUs (including the SKU name, tier/edition, family, and /// capacity) that are available to your subscription in an Azure /// region, use the `Capabilities_ListByLocation` REST API or one of /// the following commands: /// /// ```azurecli /// az sql db list-editions -l <location> -o table /// ```` /// /// ```powershell /// Get-AzSqlServerServiceObjective -Location <location> /// ```` /// </param> /// <param name="kind">Kind of database. This is metadata used for the /// Azure portal experience.</param> /// <param name="managedBy">Resource that manages the database.</param> /// <param name="createMode">Specifies the mode of database creation. /// /// Default: regular database creation. /// /// Copy: creates a database as a copy of an existing database. /// sourceDatabaseId must be specified as the resource ID of the source /// database. /// /// Secondary: creates a database as a secondary replica of an existing /// database. sourceDatabaseId must be specified as the resource ID of /// the existing primary database. /// /// PointInTimeRestore: Creates a database by restoring a point in time /// backup of an existing database. sourceDatabaseId must be specified /// as the resource ID of the existing database, and restorePointInTime /// must be specified. /// /// Recovery: Creates a database by restoring a geo-replicated backup. /// sourceDatabaseId must be specified as the recoverable database /// resource ID to restore. /// /// Restore: Creates a database by restoring a backup of a deleted /// database. sourceDatabaseId must be specified. If sourceDatabaseId /// is the database's original resource ID, then /// sourceDatabaseDeletionDate must be specified. Otherwise /// sourceDatabaseId must be the restorable dropped database resource /// ID and sourceDatabaseDeletionDate is ignored. restorePointInTime /// may also be specified to restore from an earlier point in time. /// /// RestoreLongTermRetentionBackup: Creates a database by restoring /// from a long term retention vault. /// recoveryServicesRecoveryPointResourceId must be specified as the /// recovery point resource ID. /// /// Copy, Secondary, and RestoreLongTermRetentionBackup are not /// supported for DataWarehouse edition. Possible values include: /// 'Default', 'Copy', 'Secondary', 'PointInTimeRestore', 'Restore', /// 'Recovery', 'RestoreExternalBackup', /// 'RestoreExternalBackupSecondary', 'RestoreLongTermRetentionBackup', /// 'OnlineSecondary'</param> /// <param name="collation">The collation of the database.</param> /// <param name="maxSizeBytes">The max size of the database expressed /// in bytes.</param> /// <param name="sampleName">The name of the sample schema to apply /// when creating this database. Possible values include: /// 'AdventureWorksLT', 'WideWorldImportersStd', /// 'WideWorldImportersFull'</param> /// <param name="elasticPoolId">The resource identifier of the elastic /// pool containing this database.</param> /// <param name="sourceDatabaseId">The resource identifier of the /// source database associated with create operation of this /// database.</param> /// <param name="status">The status of the database. Possible values /// include: 'Online', 'Restoring', 'RecoveryPending', 'Recovering', /// 'Suspect', 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', /// 'AutoClosed', 'Copying', 'Creating', 'Inaccessible', /// 'OfflineSecondary', 'Pausing', 'Paused', 'Resuming', 'Scaling', /// 'OfflineChangingDwPerformanceTiers', /// 'OnlineChangingDwPerformanceTiers'</param> /// <param name="databaseId">The ID of the database.</param> /// <param name="creationDate">The creation date of the database /// (ISO8601 format).</param> /// <param name="currentServiceObjectiveName">The current service level /// objective name of the database.</param> /// <param name="requestedServiceObjectiveName">The requested service /// level objective name of the database.</param> /// <param name="defaultSecondaryLocation">The default secondary region /// for this database.</param> /// <param name="failoverGroupId">Failover Group resource identifier /// that this database belongs to.</param> /// <param name="restorePointInTime">Specifies the point in time /// (ISO8601 format) of the source database that will be restored to /// create the new database.</param> /// <param name="sourceDatabaseDeletionDate">Specifies the time that /// the database was deleted.</param> /// <param name="recoveryServicesRecoveryPointId">The resource /// identifier of the recovery point associated with create operation /// of this database.</param> /// <param name="longTermRetentionBackupResourceId">The resource /// identifier of the long term retention backup associated with create /// operation of this database.</param> /// <param name="recoverableDatabaseId">The resource identifier of the /// recoverable database associated with create operation of this /// database.</param> /// <param name="restorableDroppedDatabaseId">The resource identifier /// of the restorable dropped database associated with create operation /// of this database.</param> /// <param name="catalogCollation">Collation of the metadata catalog. /// Possible values include: 'DATABASE_DEFAULT', /// 'SQL_Latin1_General_CP1_CI_AS'</param> /// <param name="zoneRedundant">Whether or not this database is zone /// redundant, which means the replicas of this database will be spread /// across multiple availability zones.</param> /// <param name="licenseType">The license type to apply for this /// database. Possible values include: 'LicenseIncluded', /// 'BasePrice'</param> /// <param name="maxLogSizeBytes">The max log size for this /// database.</param> /// <param name="earliestRestoreDate">This records the earliest start /// date and time that restore is available for this database (ISO8601 /// format).</param> /// <param name="readScale">The state of read-only routing. If enabled, /// connections that have application intent set to readonly in their /// connection string may be routed to a readonly secondary replica in /// the same region. Possible values include: 'Enabled', /// 'Disabled'</param> /// <param name="currentSku">The name and tier of the SKU.</param> /// <param name="autoPauseDelay">Time in minutes after which database /// is automatically paused. A value of -1 means that automatic pause /// is disabled</param> /// <param name="minCapacity">Minimal capacity that database will /// always have allocated, if not paused</param> public Database(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary <string, string> tags = default(IDictionary <string, string>), Sku sku = default(Sku), string kind = default(string), string managedBy = default(string), string createMode = default(string), string collation = default(string), long?maxSizeBytes = default(long?), string sampleName = default(string), string elasticPoolId = default(string), string sourceDatabaseId = default(string), string status = default(string), System.Guid?databaseId = default(System.Guid?), System.DateTime?creationDate = default(System.DateTime?), string currentServiceObjectiveName = default(string), string requestedServiceObjectiveName = default(string), string defaultSecondaryLocation = default(string), string failoverGroupId = default(string), System.DateTime?restorePointInTime = default(System.DateTime?), System.DateTime?sourceDatabaseDeletionDate = default(System.DateTime?), string recoveryServicesRecoveryPointId = default(string), string longTermRetentionBackupResourceId = default(string), string recoverableDatabaseId = default(string), string restorableDroppedDatabaseId = default(string), string catalogCollation = default(string), bool?zoneRedundant = default(bool?), string licenseType = default(string), long?maxLogSizeBytes = default(long?), System.DateTime?earliestRestoreDate = default(System.DateTime?), string readScale = default(string), Sku currentSku = default(Sku), int?autoPauseDelay = default(int?), double?minCapacity = default(double?)) : base(location, id, name, type, tags) { Sku = sku; Kind = kind; ManagedBy = managedBy; CreateMode = createMode; Collation = collation; MaxSizeBytes = maxSizeBytes; SampleName = sampleName; ElasticPoolId = elasticPoolId; SourceDatabaseId = sourceDatabaseId; Status = status; DatabaseId = databaseId; CreationDate = creationDate; CurrentServiceObjectiveName = currentServiceObjectiveName; RequestedServiceObjectiveName = requestedServiceObjectiveName; DefaultSecondaryLocation = defaultSecondaryLocation; FailoverGroupId = failoverGroupId; RestorePointInTime = restorePointInTime; SourceDatabaseDeletionDate = sourceDatabaseDeletionDate; RecoveryServicesRecoveryPointId = recoveryServicesRecoveryPointId; LongTermRetentionBackupResourceId = longTermRetentionBackupResourceId; RecoverableDatabaseId = recoverableDatabaseId; RestorableDroppedDatabaseId = restorableDroppedDatabaseId; CatalogCollation = catalogCollation; ZoneRedundant = zoneRedundant; LicenseType = licenseType; MaxLogSizeBytes = maxLogSizeBytes; EarliestRestoreDate = earliestRestoreDate; ReadScale = readScale; CurrentSku = currentSku; AutoPauseDelay = autoPauseDelay; MinCapacity = minCapacity; CustomInit(); }
/// <summary> /// Initializes a new instance of the DatabaseUpdate class. /// </summary> /// <param name="sku">The name and tier of the SKU.</param> /// <param name="createMode">Specifies the mode of database creation. /// /// Default: regular database creation. /// /// Copy: creates a database as a copy of an existing database. /// sourceDatabaseId must be specified as the resource ID of the source /// database. /// /// Secondary: creates a database as a secondary replica of an existing /// database. sourceDatabaseId must be specified as the resource ID of /// the existing primary database. /// /// PointInTimeRestore: Creates a database by restoring a point in time /// backup of an existing database. sourceDatabaseId must be specified /// as the resource ID of the existing database, and restorePointInTime /// must be specified. /// /// Recovery: Creates a database by restoring a geo-replicated backup. /// sourceDatabaseId must be specified as the recoverable database /// resource ID to restore. /// /// Restore: Creates a database by restoring a backup of a deleted /// database. sourceDatabaseId must be specified. If sourceDatabaseId /// is the database's original resource ID, then /// sourceDatabaseDeletionDate must be specified. Otherwise /// sourceDatabaseId must be the restorable dropped database resource /// ID and sourceDatabaseDeletionDate is ignored. restorePointInTime /// may also be specified to restore from an earlier point in time. /// /// RestoreLongTermRetentionBackup: Creates a database by restoring /// from a long term retention vault. /// recoveryServicesRecoveryPointResourceId must be specified as the /// recovery point resource ID. /// /// Copy, Secondary, and RestoreLongTermRetentionBackup are not /// supported for DataWarehouse edition. Possible values include: /// 'Default', 'Copy', 'Secondary', 'PointInTimeRestore', 'Restore', /// 'Recovery', 'RestoreExternalBackup', /// 'RestoreExternalBackupSecondary', 'RestoreLongTermRetentionBackup', /// 'OnlineSecondary'</param> /// <param name="collation">The collation of the database.</param> /// <param name="maxSizeBytes">The max size of the database expressed /// in bytes.</param> /// <param name="sampleName">The name of the sample schema to apply /// when creating this database. Possible values include: /// 'AdventureWorksLT', 'WideWorldImportersStd', /// 'WideWorldImportersFull'</param> /// <param name="elasticPoolId">The resource identifier of the elastic /// pool containing this database.</param> /// <param name="sourceDatabaseId">The resource identifier of the /// source database associated with create operation of this /// database.</param> /// <param name="status">The status of the database. Possible values /// include: 'Online', 'Restoring', 'RecoveryPending', 'Recovering', /// 'Suspect', 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', /// 'AutoClosed', 'Copying', 'Creating', 'Inaccessible', /// 'OfflineSecondary', 'Pausing', 'Paused', 'Resuming', 'Scaling', /// 'OfflineChangingDwPerformanceTiers', /// 'OnlineChangingDwPerformanceTiers', 'Disabled'</param> /// <param name="databaseId">The ID of the database.</param> /// <param name="creationDate">The creation date of the database /// (ISO8601 format).</param> /// <param name="currentServiceObjectiveName">The current service level /// objective name of the database.</param> /// <param name="requestedServiceObjectiveName">The requested service /// level objective name of the database.</param> /// <param name="defaultSecondaryLocation">The default secondary region /// for this database.</param> /// <param name="failoverGroupId">Failover Group resource identifier /// that this database belongs to.</param> /// <param name="restorePointInTime">Specifies the point in time /// (ISO8601 format) of the source database that will be restored to /// create the new database.</param> /// <param name="sourceDatabaseDeletionDate">Specifies the time that /// the database was deleted.</param> /// <param name="recoveryServicesRecoveryPointId">The resource /// identifier of the recovery point associated with create operation /// of this database.</param> /// <param name="longTermRetentionBackupResourceId">The resource /// identifier of the long term retention backup associated with create /// operation of this database.</param> /// <param name="recoverableDatabaseId">The resource identifier of the /// recoverable database associated with create operation of this /// database.</param> /// <param name="restorableDroppedDatabaseId">The resource identifier /// of the restorable dropped database associated with create operation /// of this database.</param> /// <param name="catalogCollation">Collation of the metadata catalog. /// Possible values include: 'DATABASE_DEFAULT', /// 'SQL_Latin1_General_CP1_CI_AS'</param> /// <param name="zoneRedundant">Whether or not this database is zone /// redundant, which means the replicas of this database will be spread /// across multiple availability zones.</param> /// <param name="licenseType">The license type to apply for this /// database. `LicenseIncluded` if you need a license, or `BasePrice` /// if you have a license and are eligible for the Azure Hybrid /// Benefit. Possible values include: 'LicenseIncluded', /// 'BasePrice'</param> /// <param name="maxLogSizeBytes">The max log size for this /// database.</param> /// <param name="earliestRestoreDate">This records the earliest start /// date and time that restore is available for this database (ISO8601 /// format).</param> /// <param name="readScale">The state of read-only routing. If enabled, /// connections that have application intent set to readonly in their /// connection string may be routed to a readonly secondary replica in /// the same region. Possible values include: 'Enabled', /// 'Disabled'</param> /// <param name="highAvailabilityReplicaCount">The number of secondary /// replicas associated with the database that are used to provide high /// availability.</param> /// <param name="secondaryType">The secondary type of the database if /// it is a secondary. Valid values are Geo and Named. Possible values /// include: 'Geo', 'Named'</param> /// <param name="currentSku">The name and tier of the SKU.</param> /// <param name="autoPauseDelay">Time in minutes after which database /// is automatically paused. A value of -1 means that automatic pause /// is disabled</param> /// <param name="currentBackupStorageRedundancy">The storage account /// type used to store backups for this database. Possible values /// include: 'Geo', 'Local', 'Zone'</param> /// <param name="requestedBackupStorageRedundancy">The storage account /// type to be used to store backups for this database. Possible values /// include: 'Geo', 'Local', 'Zone'</param> /// <param name="minCapacity">Minimal capacity that database will /// always have allocated, if not paused</param> /// <param name="pausedDate">The date when database was paused by user /// configuration or action(ISO8601 format). Null if the database is /// ready.</param> /// <param name="resumedDate">The date when database was resumed by /// user action or database login (ISO8601 format). Null if the /// database is paused.</param> /// <param name="maintenanceConfigurationId">Maintenance configuration /// id assigned to the database. This configuration defines the period /// when the maintenance updates will occur.</param> /// <param name="tags">Resource tags.</param> public DatabaseUpdate(Sku sku = default(Sku), string createMode = default(string), string collation = default(string), long?maxSizeBytes = default(long?), string sampleName = default(string), string elasticPoolId = default(string), string sourceDatabaseId = default(string), string status = default(string), System.Guid?databaseId = default(System.Guid?), System.DateTime?creationDate = default(System.DateTime?), string currentServiceObjectiveName = default(string), string requestedServiceObjectiveName = default(string), string defaultSecondaryLocation = default(string), string failoverGroupId = default(string), System.DateTime?restorePointInTime = default(System.DateTime?), System.DateTime?sourceDatabaseDeletionDate = default(System.DateTime?), string recoveryServicesRecoveryPointId = default(string), string longTermRetentionBackupResourceId = default(string), string recoverableDatabaseId = default(string), string restorableDroppedDatabaseId = default(string), string catalogCollation = default(string), bool?zoneRedundant = default(bool?), string licenseType = default(string), long?maxLogSizeBytes = default(long?), System.DateTime?earliestRestoreDate = default(System.DateTime?), string readScale = default(string), int?highAvailabilityReplicaCount = default(int?), string secondaryType = default(string), Sku currentSku = default(Sku), int?autoPauseDelay = default(int?), string currentBackupStorageRedundancy = default(string), string requestedBackupStorageRedundancy = default(string), double?minCapacity = default(double?), System.DateTime?pausedDate = default(System.DateTime?), System.DateTime?resumedDate = default(System.DateTime?), string maintenanceConfigurationId = default(string), IDictionary <string, string> tags = default(IDictionary <string, string>)) { Sku = sku; CreateMode = createMode; Collation = collation; MaxSizeBytes = maxSizeBytes; SampleName = sampleName; ElasticPoolId = elasticPoolId; SourceDatabaseId = sourceDatabaseId; Status = status; DatabaseId = databaseId; CreationDate = creationDate; CurrentServiceObjectiveName = currentServiceObjectiveName; RequestedServiceObjectiveName = requestedServiceObjectiveName; DefaultSecondaryLocation = defaultSecondaryLocation; FailoverGroupId = failoverGroupId; RestorePointInTime = restorePointInTime; SourceDatabaseDeletionDate = sourceDatabaseDeletionDate; RecoveryServicesRecoveryPointId = recoveryServicesRecoveryPointId; LongTermRetentionBackupResourceId = longTermRetentionBackupResourceId; RecoverableDatabaseId = recoverableDatabaseId; RestorableDroppedDatabaseId = restorableDroppedDatabaseId; CatalogCollation = catalogCollation; ZoneRedundant = zoneRedundant; LicenseType = licenseType; MaxLogSizeBytes = maxLogSizeBytes; EarliestRestoreDate = earliestRestoreDate; ReadScale = readScale; HighAvailabilityReplicaCount = highAvailabilityReplicaCount; SecondaryType = secondaryType; CurrentSku = currentSku; AutoPauseDelay = autoPauseDelay; CurrentBackupStorageRedundancy = currentBackupStorageRedundancy; RequestedBackupStorageRedundancy = requestedBackupStorageRedundancy; MinCapacity = minCapacity; PausedDate = pausedDate; ResumedDate = resumedDate; MaintenanceConfigurationId = maintenanceConfigurationId; Tags = tags; CustomInit(); }