Skip to content

Commit

Permalink
Added MUA support for V1 vaults (#18154)
Browse files Browse the repository at this point in the history
Added cross subscription restore

updated help text

Re-recorded test cases
  • Loading branch information
hiaga authored May 18, 2022
1 parent 6a55c50 commit ed4fe03
Show file tree
Hide file tree
Showing 76 changed files with 111,844 additions and 42,286 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="4.4.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="5.0.0-preview" />
<PackageReference Include="TimeZoneConverter" Version="3.0.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,13 @@ public static T GetOperationStatus<T>(RestAzureNS.AzureOperationResponse respons
var opStatusResponse = getOpStatus(operationId);

string testMode = Environment.GetEnvironmentVariable("AZURE_TEST_MODE");
while (opStatusResponse.Body.Status ==
ServiceClientModel.OperationStatusValues.InProgress)
while (opStatusResponse.Body.Status == ServiceClientModel.OperationStatusValues.InProgress)
{
if (!TestMockSupport.RunningMocked)
{
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
}
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0)
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0 || TestMockSupport.RunningMocked)
{
Thread.Sleep(5000);
}

opStatusResponse = getOpStatus(operationId);
}

Expand Down Expand Up @@ -84,11 +79,8 @@ public static T GetOperationStatus<T, S>(RestAzureNS.AzureOperationResponse<S> r
while (opStatusResponse.Body.Status ==
ServiceClientModel.OperationStatusValues.InProgress)
{
if (!TestMockSupport.RunningMocked)
{
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
}
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0)
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0 || TestMockSupport.RunningMocked)
{
Thread.Sleep(5000);
}
Expand Down Expand Up @@ -118,15 +110,11 @@ public static RestAzureNS.AzureOperationResponse GetOperationResult(
string testMode = Environment.GetEnvironmentVariable("AZURE_TEST_MODE");
while (opStatusResponse.Response.StatusCode == SystemNet.HttpStatusCode.Accepted)
{
if (!TestMockSupport.RunningMocked)
{
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
}
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0)
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0 || TestMockSupport.RunningMocked)
{
Thread.Sleep(5000);
}

opStatusResponse = getOpStatus(operationId);
}

Expand All @@ -153,15 +141,11 @@ public static RestAzureNS.AzureOperationResponse<T> GetOperationStatusDataMove<T
string testMode = Environment.GetEnvironmentVariable("AZURE_TEST_MODE");
while (opStatusResponse.Body.Status == "InProgress")
{
if (!TestMockSupport.RunningMocked)
{
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
}
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0)
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0 || TestMockSupport.RunningMocked)
{
Thread.Sleep(5000);
}

opStatusResponse = getOpStatus(operationId);
}
opStatusResponse = getOpStatus(operationId);
Expand All @@ -187,15 +171,11 @@ public static RestAzureNS.AzureOperationResponse<T> GetOperationResult<T>(
string testMode = Environment.GetEnvironmentVariable("AZURE_TEST_MODE");
while (opStatusResponse.Response.StatusCode == SystemNet.HttpStatusCode.Accepted)
{
if (!TestMockSupport.RunningMocked)
{
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
}
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0)
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0 || TestMockSupport.RunningMocked)
{
Thread.Sleep(5000);
}

opStatusResponse = getOpStatus(operationId);
}
opStatusResponse = getOpStatus(operationId);
Expand Down Expand Up @@ -236,15 +216,11 @@ public static RestAzureNS.AzureOperationResponse<T> GetOperationResult<T>(
string testMode = Environment.GetEnvironmentVariable("AZURE_TEST_MODE");
while (opStatusResponse.Response.StatusCode == SystemNet.HttpStatusCode.Accepted)
{
if (!TestMockSupport.RunningMocked)
{
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
}
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0)
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0 || TestMockSupport.RunningMocked)
{
Thread.Sleep(5000);
}

opStatusResponse = getOpStatus(operationId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public partial class PolicyHelpers
// <summary>
/// Helper function to validate long term rentention policy and simple schedule policy.
/// </summary>
public static void ValidateLongTermRetentionPolicyWithSimpleRetentionPolicy(
public static void ValidateLongTermRetentionPolicyWithSimpleSchedulePolicy(
LongTermRetentionPolicy ltrPolicy,
SimpleSchedulePolicy schPolicy)
{
Expand Down Expand Up @@ -124,7 +124,7 @@ public static void ValidateLongTermRetentionPolicyWithSimpleRetentionPolicy(
// <summary>
/// Helper function to validate long term rentention policy and simple schedule policy.
/// </summary>
public static void ValidateLongTermRetentionPolicyWithSimpleRetentionPolicy(
public static void ValidateLongTermRetentionPolicyWithSimpleSchedulePolicy(
LongTermRetentionPolicy ltrPolicy,
SimpleSchedulePolicyV2 schPolicy)
{
Expand Down Expand Up @@ -226,7 +226,7 @@ public static void ValidateLongTermRetentionPolicyWithSimpleRetentionPolicy(
}
}

public static void ValidateLongTermRetentionPolicyWithSimpleRetentionPolicy(
public static void ValidateLongTermRetentionPolicyWithSimpleSchedulePolicy(
SQLRetentionPolicy ltrPolicy,
SQLSchedulePolicy schPolicy)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ public enum VaultParams
VaultLocation,
}

public enum ResourceGuardParams
{
Token,
IsMUAOperation,
}

public enum ContainerParams
{
Vault,
Expand Down Expand Up @@ -77,7 +83,8 @@ public enum RestoreVMBackupItemParams
TargetVMName,
TargetVNetName,
TargetVNetResourceGroup,
TargetSubnetName
TargetSubnetName,
TargetSubscriptionId
}

public enum RestoreFSBackupItemParams
Expand Down Expand Up @@ -123,7 +130,8 @@ public enum PolicyParams
ResourceName,
FixForInconsistentItems,
ScheduleRunFrequency,
PolicySubType
PolicySubType,
ExistingPolicy
}

public enum ItemParams
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -739,4 +739,25 @@ Please contact Microsoft for further assistance.</value>
<data name="InvalidPolicyForTrustedVMProtection" xml:space="preserve">
<value>Trusted VM can only be protected using Enhanced policy. Please provide a valid AzureVM Enhanced policy</value>
</data>
<data name="ProtectedItemURICantBeNull" xml:space="preserve">
<value>ProtectedItemURI can't be null as the operation is protected with ResourceGuard</value>
</data>
<data name="PolicyUpdateNotCritical" xml:space="preserve">
<value>Operation not critical, please try without the Token parameter. MUA currently only protects reducing or disabling retention times</value>
</data>
<data name="UnexpectedParameterToken" xml:space="preserve">
<value>{0} is not protected via MUA, either protect or try without the Token parameter</value>
</data>
<data name="BackupConfigUpdateNotCritical" xml:space="preserve">
<value>Operation not critical, please try without the Token parameter. MUA currently protects disabling SoftDelete or SecurityFeatures only when it was previously enabled</value>
</data>
<data name="ResourceGuardMappingNotFound" xml:space="preserve">
<value>ResourceGuardMapping not found</value>
</data>
<data name="DisableWithRetainBackupNotCrititcal" xml:space="preserve">
<value>Invalid parameter Token: Stop protection with retain backup data is not MUA protected</value>
</data>
<data name="CRRNotSupportedWIthCSR" xml:space="preserve">
<value>Cross region restore is not supported along with cross subscription restore, please try passing either RestoreToSecondaryRegion or TargetSubscriptionId parameter but not both</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="4.4.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="5.0.0-preview" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit ed4fe03

Please sign in to comment.