Skip to content

Commit 7161ff3

Browse files
committed
Merge dev1
2 parents e065298 + e65bfea commit 7161ff3

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup/Cmdlets/Restore/RestoreAzureRMRecoveryServicesBackupItem.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@ public override void ExecuteCmdlet()
5454
{
5555
base.ExecuteCmdlet();
5656
StorageAccountName = StorageAccountName.ToLower();
57-
WriteDebug("InsideRestore. going to create ResourceManager Client");
58-
ResourcesNS.ResourceManagementClient rmClient =
59-
AzureSession.ClientFactory.CreateClient<ResourcesNS.ResourceManagementClient>(
60-
DefaultContext, AzureEnvironment.Endpoint.ResourceManager);
61-
WriteDebug("Client Created successfully");
6257
ResourceIdentity identity = new ResourceIdentity();
6358
identity.ResourceName = StorageAccountName;
6459
identity.ResourceProviderNamespace = "Microsoft.ClassicStorage/storageAccounts";
@@ -70,14 +65,14 @@ public override void ExecuteCmdlet()
7065
{
7166
WriteDebug(String.Format("Query Microsoft.ClassicStorage with name = {0}",
7267
StorageAccountName));
73-
resource = rmClient.Resources.GetAsync(StorageAccountResourceGroupName,
68+
resource = RmClient.Resources.GetAsync(StorageAccountResourceGroupName,
7469
identity, CancellationToken.None).Result;
7570
}
7671
catch (Exception)
7772
{
7873
identity.ResourceProviderNamespace = "Microsoft.Storage/storageAccounts";
7974
identity.ResourceProviderApiVersion = "2016-01-01";
80-
resource = rmClient.Resources.GetAsync(StorageAccountResourceGroupName,
75+
resource = RmClient.Resources.GetAsync(StorageAccountResourceGroupName,
8176
identity, CancellationToken.None).Result;
8277
}
8378

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup/RecoveryServicesBackupCmdletBase.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
using Microsoft.Azure.Commands.Common.Authentication;
3333
using Microsoft.Azure.Commands.Common.Authentication.Models;
3434
using Microsoft.WindowsAzure.Commands.Utilities.Common;
35+
using ResourcesNS = Microsoft.Azure.Management.Resources;
3536

3637
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets
3738
{
@@ -45,10 +46,17 @@ public abstract class RecoveryServicesBackupCmdletBase : AzureRMCmdlet
4546

4647
protected ServiceClientAdapter ServiceClientAdapter { get; set; }
4748

49+
protected ResourcesNS.ResourceManagementClient RmClient { get; set; }
50+
4851
protected void InitializeAzureBackupCmdlet()
4952
{
5053
var cloudServicesClient = AzureSession.ClientFactory.CreateClient<CloudServiceManagementClient>(DefaultContext, AzureEnvironment.Endpoint.ResourceManager);
5154
ServiceClientAdapter = new ServiceClientAdapter(cloudServicesClient.Credentials, cloudServicesClient.BaseUri);
55+
56+
WriteDebug("InsideRestore. going to create ResourceManager Client");
57+
RmClient = AzureSession.ClientFactory.CreateClient<ResourcesNS.ResourceManagementClient>(DefaultContext, AzureEnvironment.Endpoint.ResourceManager);
58+
WriteDebug("Client Created successfully");
59+
5260
Logger.Instance = new Logger(WriteWarning, WriteDebug, WriteVerbose, ThrowTerminatingError);
5361
}
5462

0 commit comments

Comments
 (0)