From 9901e216b2e87c44fd45e6284dd0fc0d79ca10e6 Mon Sep 17 00:00:00 2001 From: Himanshu Agarwal Date: Fri, 11 Jun 2021 07:48:10 +0530 Subject: [PATCH] fixed Disable SQL AG AutoProtection (#15241) --- .../DisableAzureRmRecoveryServicesBackupAutoProtection.cs | 7 ++++--- src/RecoveryServices/RecoveryServices/ChangeLog.md | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/RecoveryServices/RecoveryServices.Backup/Cmdlets/Item/DisableAzureRmRecoveryServicesBackupAutoProtection.cs b/src/RecoveryServices/RecoveryServices.Backup/Cmdlets/Item/DisableAzureRmRecoveryServicesBackupAutoProtection.cs index 08da78a27411..a0c0030b11f4 100644 --- a/src/RecoveryServices/RecoveryServices.Backup/Cmdlets/Item/DisableAzureRmRecoveryServicesBackupAutoProtection.cs +++ b/src/RecoveryServices/RecoveryServices.Backup/Cmdlets/Item/DisableAzureRmRecoveryServicesBackupAutoProtection.cs @@ -123,9 +123,10 @@ public override void ExecuteCmdlet() containerNameResponse = HelperUtils.GetContainerUri( keyValueDictResponse, itemResponse.Properties.ItemId); - if (String.Compare(itemNameResponse, itemName, true) == 0 && - String.Compare(containerUri.Split(';')[3], containerNameResponse.Split(';')[2], true) == 0) - { + if((String.Compare(itemNameResponse, itemName, true) == 0) && + ((itemType.Contains("sqlavailabilitygroup") && String.Compare(containerUri.Split(';')[1], containerNameResponse, true) == 0) + || (String.Compare(containerUri.Split(';')[3], containerNameResponse.Split(';')[2], true) == 0))) + { intentName = itemResponse.Name; break; } diff --git a/src/RecoveryServices/RecoveryServices/ChangeLog.md b/src/RecoveryServices/RecoveryServices/ChangeLog.md index f3ccef8f3131..21bc5f88bc82 100644 --- a/src/RecoveryServices/RecoveryServices/ChangeLog.md +++ b/src/RecoveryServices/RecoveryServices/ChangeLog.md @@ -18,6 +18,7 @@ - Additional information about change #1 --> ## Upcoming Release +* Fixed Disable SQL AG AutoProtection. * Added cross tenant DS Move. * Removed restriction to fetch recovery points only for a 30 days time range. * Enabled CRR for new regions.