-
Notifications
You must be signed in to change notification settings - Fork 4k
[Az.RecoveryServices.Backup] Added suspend backup as MUA protected operation #27835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds suspend backup as an MUA-protected operation and updates related cmdlets, providers, and tests.
- Documented the new
RetainRecoveryPointsAsPerPolicy
option in ChangeLog. - Updated the Disable-AzRecoveryServicesBackupProtection cmdlet and provider SuspendBackup methods to accept an auxiliary access token and MUA flag.
- Extended PowerShell and C# scenario tests to cover the suspend backup flow.
- Revised the purge date calculation logic in
AzureWorkloadSQLDatabaseProtectedItem
.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
src/RecoveryServices/RecoveryServices/ChangeLog.md | Added MUA-protected RetainRecoveryPointsAsPerPolicy entry |
src/RecoveryServices/RecoveryServices.Backup/Cmdlets/Item/DisableAzureRmRecoveryServicesBackupProtection.cs | Removed previous validation to enable suspend backup scenario |
src/RecoveryServices/RecoveryServices.Backup.Test/ScenarioTests/IaasVm/ItemTests.ps1 | Updated VM names and added suspend backup assertions |
src/RecoveryServices/RecoveryServices.Backup.Test/ScenarioTests/IaasVm/ItemTests.cs | Un-skipped the MUA test case |
src/RecoveryServices/RecoveryServices.Backup.Providers/Providers/IaasVmPsBackupProvider.cs | Added auxiliaryAccessToken and isMUAProtected parameters |
src/RecoveryServices/RecoveryServices.Backup.Providers/Providers/AzureWorkloadPsBackupProvider.cs | Same for Azure workload provider |
src/RecoveryServices/RecoveryServices.Backup.Providers/Providers/AzureFilesPsBackupProvider.cs | Same for Azure files provider |
src/RecoveryServices/RecoveryServices.Backup.Models/AzureVmWorkloadModels/AzureWorkloadSQLDatabaseProtectedItem.cs | Changed purge date computation to use DateTime.UtcNow |
Comments suppressed due to low confidence (1)
src/RecoveryServices/RecoveryServices.Backup/Cmdlets/Item/DisableAzureRmRecoveryServicesBackupProtection.cs:103
- The variable 'plainToken' is assigned but never used after removing the previous validation block. Consider removing this unused variable to clean up the code.
string plainToken = HelperUtils.GetPlainToken(Token, SecureToken);
string auxiliaryAccessToken = ProviderData.ContainsKey(ResourceGuardParams.Token) ? (string)ProviderData[ResourceGuardParams.Token] : null; | ||
bool isMUAProtected = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This initialization of 'auxiliaryAccessToken' and the 'isMUAProtected' flag is duplicated across multiple providers. Consider refactoring into a shared helper to reduce code duplication.
string auxiliaryAccessToken = ProviderData.ContainsKey(ResourceGuardParams.Token) ? (string)ProviderData[ResourceGuardParams.Token] : null; | |
bool isMUAProtected = true; | |
(string auxiliaryAccessToken, bool isMUAProtected) = GetAuxiliaryAccessTokenAndMUAProtection(); |
Copilot uses AI. Check for mistakes.
resourceGroupName: resourceGroupName, | ||
auxiliaryAccessToken, | ||
isMUAProtected, | ||
true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Passing a positional boolean literal 'true' makes the argument’s intent unclear. Consider using a named argument or constant to clarify its purpose.
true); | |
enableValidation: true); |
Copilot uses AI. Check for mistakes.
...ecoveryServices.Backup.Models/AzureVmWorkloadModels/AzureWorkloadSQLDatabaseProtectedItem.cs
Show resolved
Hide resolved
@@ -129,6 +129,9 @@ public RestAzureNS.AzureOperationResponse<ProtectedItemResource> SuspendBackup() | |||
string resourceGroupName = (string)ProviderData[VaultParams.ResourceGroupName]; | |||
|
|||
ItemBase itemBase = (ItemBase)ProviderData[ItemParams.Item]; | |||
|
|||
string auxiliaryAccessToken = ProviderData.ContainsKey(ResourceGuardParams.Token) ? (string)ProviderData[ResourceGuardParams.Token] : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This initialization is duplicated from other providers. Consider refactoring into a shared helper method to reduce code duplication.
string auxiliaryAccessToken = ProviderData.ContainsKey(ResourceGuardParams.Token) ? (string)ProviderData[ResourceGuardParams.Token] : null; | |
string auxiliaryAccessToken = GetAuxiliaryAccessToken(); |
Copilot uses AI. Check for mistakes.
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
@@ -101,11 +101,7 @@ public override void ExecuteCmdlet() | |||
string resourceGroupName = resourceIdentifier.ResourceGroupName; | |||
|
|||
string plainToken = HelperUtils.GetPlainToken(Token, SecureToken); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use SecureStringExtensions.ConvertToString
Description
Added suspend backup as MUA protected operation i.e. RetainRecoveryPointsAsPerPolicy as MUA protected operation in Disable-AzRecoveryServicesBackupProtection cmdlet.
Mandatory Checklist
Please choose the target release of Azure PowerShell. (⚠️ Target release is a different concept from API readiness. Please click below links for details.)
Check this box to confirm: I have read the Submitting Changes section of
CONTRIBUTING.md
and reviewed the following information:ChangeLog.md
file(s) appropriatelysrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md
.## Upcoming Release
header in the past tense.ChangeLog.md
if no new release is required, such as fixing test case only.