From fb4ba52a7d922312933954a174d2ae2d39210cdf Mon Sep 17 00:00:00 2001 From: dragonfly91 Date: Mon, 8 Jun 2015 18:39:17 +0530 Subject: [PATCH 1/2] Including necessary resource DLLs in the csproj --- .../Commands.AzureBackup/Commands.AzureBackup.csproj | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj index ecc3662b0c45..9368865fe23e 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj @@ -43,6 +43,14 @@ false + + False + Resources\BackupManagementInterface.dll + + + False + Resources\BMSCommonInterface.dll + ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll @@ -116,6 +124,7 @@ + @@ -170,6 +179,8 @@ + + From cf7435b5ac9d7b27e8e012b50de371c02f328162 Mon Sep 17 00:00:00 2001 From: dragonfly91 Date: Tue, 9 Jun 2015 15:28:14 +0530 Subject: [PATCH 2/2] Download Vault Creds cmdlet fixes post component testing. --- .../GetAzureBackupVaultCredentials.cs | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/VaultCredentials/GetAzureBackupVaultCredentials.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/VaultCredentials/GetAzureBackupVaultCredentials.cs index c3169e239210..70f4908cec92 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/VaultCredentials/GetAzureBackupVaultCredentials.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/VaultCredentials/GetAzureBackupVaultCredentials.cs @@ -45,8 +45,11 @@ public override void ExecuteCmdlet() ExecutionBlock(() => { - WriteVerbose(string.Format("Profile == null : {0}", (Profile == null).ToString())); - WriteVerbose(string.Format("Profile.DefaultSubscription == null : {0}", (Profile.DefaultSubscription == null).ToString())); + if (!Directory.Exists(TargetLocation)) + { + throw new ArgumentException("The target location provided is not a directory. Please provide a directory."); + } + string subscriptionId = Profile.DefaultSubscription.Id.ToString(); string resourceType = "resourceType"; string displayName = subscriptionId + "_" + ResourceGroupName + "_" + ResourceName; @@ -62,7 +65,6 @@ public override void ExecuteCmdlet() DateTime.UtcNow.AddHours(this.GetCertificateExpiryInHours())); AcsNamespace acsNamespace = new AcsNamespace(); - string channelIntegrityKey = string.Empty; try { @@ -80,8 +82,16 @@ public override void ExecuteCmdlet() string vaultCredsFileContent = GenerateVaultCreds(cert, subscriptionId, resourceType, acsNamespace); // prepare for download - string fileName = string.Format("{0}_{1}.VaultCredentials", displayName, DateTime.UtcNow.ToLongDateString()); - string filePath = Path.Combine(Path.GetDirectoryName(TargetLocation), fileName); + string fileName = string.Format("{0}_{1}.VaultCredentials", displayName, DateTime.UtcNow.ToString("yyyy-dd-M--HH-mm-ss")); + string directoryPath = Path.GetDirectoryName(TargetLocation); + if (directoryPath == null) + { + // TargetLocation is a root path + directoryPath = TargetLocation; + } + string filePath = Path.Combine(directoryPath, fileName); + WriteVerbose(string.Format("Saving Vault Credentials to file : {0}", filePath)); + File.WriteAllBytes(filePath, Encoding.UTF8.GetBytes(vaultCredsFileContent)); // Output filename back to user