diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj
index 70ae4e391ea3..d72ba0aa6bc5 100644
--- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj
@@ -136,6 +136,7 @@
+
@@ -173,6 +174,7 @@
+
Always
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/BackupItemTests.ps1 b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/BackupItemTests.ps1
index 8ae666eb3075..8dbd7621d05c 100644
--- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/BackupItemTests.ps1
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/BackupItemTests.ps1
@@ -8,6 +8,7 @@ $Location = "SouthEast Asia"
$PolicyName = "Policy9";
$PolicyId = "c87bbada-6e1b-4db2-b76c-9062d28959a4";
$POName = "iaasvmcontainer;dev01testing;dev01testing"
+$ItemName = "iaasvmcontainer;dev01testing;dev01testing"
function Test-BackUpAzureBackUpItem
@@ -17,8 +18,6 @@ function Test-BackUpAzureBackUpItem
$azureBackUpItem.ResourceName = $ResourceName
$azureBackUpItem.Location = $Location
$azureBackUpItem.ContainerUniqueName = $ContainerName
- $azureBackUpItem.ContainerType = $ContainerType
- $azureBackUpItem.DataSourceId = $DataSourceId
- $azureBackUpItem.Type = $DataSourceType
+ $azureBackUpItem.ItemName = $ItemName
$jobId = Backup-AzureBackupItem -Item $azureBackUpItem
}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/RecoveryPointTests.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/RecoveryPointTests.cs
index 9622c170cc15..949951df8b3c 100644
--- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/RecoveryPointTests.cs
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/RecoveryPointTests.cs
@@ -19,6 +19,12 @@ namespace Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests
{
public class RecoveryPointTests : AzureBackupTestsBase
{
+ [Fact]
+ public void GetRecoveryPointsTests()
+ {
+ this.RunPowerShellTest("Test-GetAzureRecoveryPoints");
+ }
+
[Fact]
public void GetRecoveryPointTests()
{
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/RecoveryPointTests.ps1 b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/RecoveryPointTests.ps1
index 9ba98ab4fed6..54856ee6c503 100644
--- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/RecoveryPointTests.ps1
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/RecoveryPointTests.ps1
@@ -8,18 +8,18 @@ $Location = "SouthEast Asia"
$PolicyName = "Policy9";
$PolicyId = "c87bbada-6e1b-4db2-b76c-9062d28959a4";
$POName = "iaasvmcontainer;dev01testing;dev01testing"
+$ItemName = "iaasvmcontainer;dev01testing;dev01testing"
+$RecoveryPointName = "12520735098347"
-function Test-GetAzureRecoveryPoint
+function Test-GetAzureRecoveryPoints
{
$azureBackUpItem = New-Object Microsoft.Azure.Commands.AzureBackup.Models.AzureBackupItem
$azureBackUpItem.ResourceGroupName = $ResourceGroupName
$azureBackUpItem.ResourceName = $ResourceGroupName
$azureBackUpItem.Location = $Location
$azureBackUpItem.ContainerUniqueName = $ContainerName
- $azureBackUpItem.ContainerType = $ContainerType
- $azureBackUpItem.DataSourceId = $DataSourceId
- $azureBackUpItem.Type = $DataSourceType
+ $azureBackUpItem.ItemName = $ItemName
$recoveryPoints = Get-AzureBackupRecoveryPoint -Item $azureBackUpItem
if (!($recoveryPoints -eq $null))
{
@@ -30,4 +30,21 @@ function Test-GetAzureRecoveryPoint
Assert-NotNull $recoveryPoint.RecoveryPointId 'RecoveryPointId should not be null'
}
}
+}
+
+function Test-GetAzureRecoveryPoint
+{
+ $azureBackUpItem = New-Object Microsoft.Azure.Commands.AzureBackup.Models.AzureBackupItem
+ $azureBackUpItem.ResourceGroupName = $ResourceGroupName
+ $azureBackUpItem.ResourceName = $ResourceGroupName
+ $azureBackUpItem.Location = $Location
+ $azureBackUpItem.ContainerUniqueName = $ContainerName
+ $azureBackUpItem.ItemName = $ItemName
+ $recoveryPoint = Get-AzureBackupRecoveryPoint -Item $azureBackUpItem -Id $RecoveryPointName
+ if (!($recoveryPoint -eq $null))
+ {
+ Assert-NotNull $recoveryPoint.RecoveryPointTime 'RecoveryPointTime should not be null'
+ Assert-NotNull $recoveryPoint.RecoveryPointType 'RecoveryPointType should not be null'
+ Assert-NotNull $recoveryPoint.RecoveryPointId 'RecoveryPointId should not be null'
+ }
}
\ No newline at end of file
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/RestoreItemTests.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/RestoreItemTests.cs
new file mode 100644
index 000000000000..ff1aa4acceb9
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/RestoreItemTests.cs
@@ -0,0 +1,28 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using Microsoft.WindowsAzure.Commands.ScenarioTest;
+using Xunit;
+
+namespace Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests
+{
+ public class RestoreItemTests : AzureBackupTestsBase
+ {
+ [Fact]
+ public void RestoreAzureBackUpItem()
+ {
+ this.RunPowerShellTest("Test-RestoreAzureBackUpItem");
+ }
+ }
+}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/RestoreItemTests.ps1 b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/RestoreItemTests.ps1
new file mode 100644
index 000000000000..d299e9848257
--- /dev/null
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/RestoreItemTests.ps1
@@ -0,0 +1,26 @@
+$ResourceGroupName = "backuprg"
+$ResourceName = "backuprn"
+$ContainerName = "iaasvmcontainer;dev01testing;dev01testing"
+$ContainerType = "IaasVMContainer"
+$DataSourceType = "VM"
+$DataSourceId = "17593283453810"
+$Location = "southeastasia"
+$PolicyName = "Policy9";
+$PolicyId = "c87bbada-6e1b-4db2-b76c-9062d28959a4";
+$POName = "iaasvmcontainer;dev01testing;dev01testing"
+$ItemName = "iaasvmcontainer;dev01testing;dev01testing"
+$RecoveryPointName = "12520735098347"
+$StorageAccountName = "portalvhds7jzk3jty85qx5"
+
+
+function Test-RestoreAzureBackUpItem
+{
+ $azureBackUpRecoveryPoint = New-Object Microsoft.Azure.Commands.AzureBackup.Models.AzureBackupRecoveryPoint
+ $azureBackUpRecoveryPoint.ResourceGroupName = $ResourceGroupName
+ $azureBackUpRecoveryPoint.ResourceName = $ResourceName
+ $azureBackUpRecoveryPoint.Location = $Location
+ $azureBackUpRecoveryPoint.ContainerUniqueName = $ContainerName
+ $azureBackUpRecoveryPoint.ItemName = $ItemName
+ $azureBackUpRecoveryPoint.RecoveryPointName = $RecoveryPointName
+ $jobId = Restore-AzureBackupItem -RecoveryPoint $azureBackUpRecoveryPoint -StorageAccountName $StorageAccountName
+}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Backup/TriggerBackUp.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Backup/TriggerBackUp.cs
index 1ff9208fd7c1..a7737e7bdbc1 100644
--- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Backup/TriggerBackUp.cs
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Backup/TriggerBackUp.cs
@@ -40,8 +40,8 @@ public override void ExecuteCmdlet()
WriteDebug(string.Format("Triggered backup. Converting response {0}", operationId));
- //var operationStatus = TrackOperation(operationId);
- //WriteObject(GetCreatedJobs(new Models.AzurePSBackupVault(Item.ResourceGroupName, Item.ResourceName, Item.Location), operationStatus.JobList).FirstOrDefault());
+ var operationStatus = TrackOperation(operationId);
+ WriteObject(GetCreatedJobs(new Models.AzurePSBackupVault(Item.ResourceGroupName, Item.ResourceName, Item.Location), operationStatus.JobList).FirstOrDefault());
});
}
}
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Restore/TriggerRestore.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Restore/TriggerRestore.cs
index 1a2d3aeedb37..637b68ce9863 100644
--- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Restore/TriggerRestore.cs
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Restore/TriggerRestore.cs
@@ -20,13 +20,14 @@
using Microsoft.Azure.Management.BackupServices.Models;
using MBS = Microsoft.Azure.Management.BackupServices;
using System.Web.Script.Serialization;
+using Microsoft.Azure.Commands.AzureBackup.Models;
namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
{
///
/// Trigger Restore Job
///
- [Cmdlet(VerbsData.Restore, "AzureBackupItem"), OutputType(typeof(Guid))]
+ [Cmdlet(VerbsData.Restore, "AzureBackupItem"), OutputType(typeof(AzureBackupJob))]
public class RestoreAzureBackup : AzureBackupRestoreBase
{
[Parameter(Position = 1, Mandatory = true, HelpMessage = AzureBackupCmdletHelpMessage.StorageAccountName)]
diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Microsoft.Azure.Commands.AzureBackup.format.ps1xml b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Microsoft.Azure.Commands.AzureBackup.format.ps1xml
index 500adb8d49be..6139c53afa78 100644
--- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Microsoft.Azure.Commands.AzureBackup.format.ps1xml
+++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Microsoft.Azure.Commands.AzureBackup.format.ps1xml
@@ -75,5 +75,49 @@
+
+ Microsoft.Azure.Commands.AzureBackup.Models.AzureBackupRecoveryPoint
+
+ Microsoft.Azure.Commands.AzureBackup.Models.AzureBackupRecoveryPoint
+
+
+
+
+
+ 18
+
+
+
+ 18
+
+
+
+ 22
+
+
+
+ 36
+
+
+
+
+
+
+ RecoveryPointName
+
+
+ RecoveryPointType
+
+
+ RecoveryPointTime
+
+
+ ContainerUniqueName
+
+
+
+
+
+