From 9962c1cca87d3d17599a07f3aa78abd23d43cf94 Mon Sep 17 00:00:00 2001 From: markcowl Date: Tue, 15 Mar 2016 17:04:11 -0700 Subject: [PATCH 1/4] Refactoring commands.common.storage to remove storage management dependency --- .../ARM.Storage.3/ARMStorageProvider.cs | 37 +++++++++ .../ARM.Storage.3/ARMStorageService.cs | 81 +++++++++++++++++++ .../AzureContextExtensions.cs | 1 - .../Commands.Common.Storage.csproj | 6 +- .../IStorageService.cs | 56 +++++++++++++ .../IStorageServiceProvider.cs | 27 +++++++ .../StorageUtilities.cs | 61 +++++++------- .../Commands.Compute/Commands.Compute.csproj | 11 ++- .../Common/DiagnosticsHelper.cs | 4 +- .../Common/StorageManagementClient.cs | 40 +++++++++ .../Commands.Management.Storage.csproj | 6 ++ .../Models/PSStorageAccount.cs | 2 +- .../SetAzureRmCurrentStorageAccount.cs | 3 +- 13 files changed, 294 insertions(+), 41 deletions(-) create mode 100644 src/Common/Commands.Common.Storage/Adapters/ARM.Storage.3/ARMStorageProvider.cs create mode 100644 src/Common/Commands.Common.Storage/Adapters/ARM.Storage.3/ARMStorageService.cs create mode 100644 src/Common/Commands.Common.Storage/IStorageService.cs create mode 100644 src/Common/Commands.Common.Storage/IStorageServiceProvider.cs create mode 100644 src/ResourceManager/Compute/Commands.Compute/Common/StorageManagementClient.cs diff --git a/src/Common/Commands.Common.Storage/Adapters/ARM.Storage.3/ARMStorageProvider.cs b/src/Common/Commands.Common.Storage/Adapters/ARM.Storage.3/ARMStorageProvider.cs new file mode 100644 index 000000000000..5328488c2b66 --- /dev/null +++ b/src/Common/Commands.Common.Storage/Adapters/ARM.Storage.3/ARMStorageProvider.cs @@ -0,0 +1,37 @@ +// ---------------------------------------------------------------------------------- +// +// 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 System.Management.Automation; +using Microsoft.Azure.Management.Storage; +using Microsoft.WindowsAzure.Commands.Common.Storage; + +namespace Microsoft.Azure.Commands.Management.Storage.Models +{ + public class ARMStorageProvider : IStorageServiceProvider + { + IStorageManagementClient _client; + + public ARMStorageProvider(IStorageManagementClient client) + { + _client = client; + } + public IStorageService GetStorageService(string name, string resourceGroupName) + { + var account = _client.StorageAccounts.GetProperties(resourceGroupName, name); + var keys = _client.StorageAccounts.ListKeys(resourceGroupName, name); + return new ARMStorageService(account.StorageAccount, keys.StorageAccountKeys.Key1, + keys.StorageAccountKeys.Key2); + } + } +} diff --git a/src/Common/Commands.Common.Storage/Adapters/ARM.Storage.3/ARMStorageService.cs b/src/Common/Commands.Common.Storage/Adapters/ARM.Storage.3/ARMStorageService.cs new file mode 100644 index 000000000000..fd0da45ad8ec --- /dev/null +++ b/src/Common/Commands.Common.Storage/Adapters/ARM.Storage.3/ARMStorageService.cs @@ -0,0 +1,81 @@ +// ---------------------------------------------------------------------------------- +// +// 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 System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.WindowsAzure.Commands.Common.Storage; + +namespace Microsoft.Azure.Commands.Management.Storage.Models +{ + public class ARMStorageService : IStorageService + { + Azure.Management.Storage.Models.StorageAccount _account; + List _authenticationKeys = new List(); + public ARMStorageService(Azure.Management.Storage.Models.StorageAccount account, + params string[] authenticationKeys) + { + _account = account; + foreach (var key in authenticationKeys) + { + _authenticationKeys.Add(key); + } + } + + public Uri BlobEndpoint + { + get { return _account.PrimaryEndpoints.Blob; } + } + + public Uri FileEndpoint + { + get { return _account.PrimaryEndpoints.File; } + } + + public Uri QueueEndpoint + { + get { return _account.PrimaryEndpoints.Queue; } + } + + public Uri TableEndpoint + { + get { return _account.PrimaryEndpoints.Table; } + } + + public string Name + { + get { return _account.Name; } + } + + public List AuthenticationKeys + { + get { return _authenticationKeys; } + } + + public static string ParseResourceGroupFromId(string idFromServer) + { + if (!string.IsNullOrEmpty(idFromServer)) + { + string[] tokens = idFromServer.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + + return tokens[3]; + } + + return null; + } + + } +} diff --git a/src/Common/Commands.Common.Storage/AzureContextExtensions.cs b/src/Common/Commands.Common.Storage/AzureContextExtensions.cs index bb3604da3d0b..268386c44a44 100644 --- a/src/Common/Commands.Common.Storage/AzureContextExtensions.cs +++ b/src/Common/Commands.Common.Storage/AzureContextExtensions.cs @@ -14,7 +14,6 @@ using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Storage; -using ArmStorage = Microsoft.Azure.Management.Storage; using SmStorage = Microsoft.WindowsAzure.Management.Storage; using Microsoft.WindowsAzure.Storage; diff --git a/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj b/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj index 85b805df9968..8131020b438f 100644 --- a/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj +++ b/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj @@ -63,10 +63,6 @@ ..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll True - - False - ..\..\packages\Microsoft.Azure.Management.Storage.3.0.0\lib\net40\Microsoft.Azure.Management.Storage.dll - False ..\..\packages\Microsoft.Azure.Management.Resources.2.19.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll @@ -162,6 +158,8 @@ + + True True diff --git a/src/Common/Commands.Common.Storage/IStorageService.cs b/src/Common/Commands.Common.Storage/IStorageService.cs new file mode 100644 index 000000000000..9e94bd3216db --- /dev/null +++ b/src/Common/Commands.Common.Storage/IStorageService.cs @@ -0,0 +1,56 @@ +// ---------------------------------------------------------------------------------- +// +// 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 System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.WindowsAzure.Storage.Auth; + +namespace Microsoft.WindowsAzure.Commands.Common.Storage +{ + public interface IStorageService + { + /// + /// The eblob service endpoint + /// + Uri BlobEndpoint { get; } + + /// + /// The file service endpoint + /// + Uri FileEndpoint { get; } + + /// + /// The queue service endpoint + /// + Uri QueueEndpoint { get; } + + /// + /// The table service endpoint + /// + Uri TableEndpoint { get; } + + /// + /// The storage account name + /// + string Name { get;} + + /// + /// Authentication keys for the storage account + /// + List AuthenticationKeys { get; } + } +} diff --git a/src/Common/Commands.Common.Storage/IStorageServiceProvider.cs b/src/Common/Commands.Common.Storage/IStorageServiceProvider.cs new file mode 100644 index 000000000000..d1d626d39210 --- /dev/null +++ b/src/Common/Commands.Common.Storage/IStorageServiceProvider.cs @@ -0,0 +1,27 @@ +// ---------------------------------------------------------------------------------- +// +// 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 System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.WindowsAzure.Commands.Common.Storage +{ + public interface IStorageServiceProvider + { + IStorageService GetStorageService(string name, string resourceGroupName); + } +} diff --git a/src/Common/Commands.Common.Storage/StorageUtilities.cs b/src/Common/Commands.Common.Storage/StorageUtilities.cs index bc28956c0085..dd685fc2b8a4 100644 --- a/src/Common/Commands.Common.Storage/StorageUtilities.cs +++ b/src/Common/Commands.Common.Storage/StorageUtilities.cs @@ -1,19 +1,28 @@ - -using System.CodeDom; -using System.Diagnostics.Eventing.Reader; -using System.Text; -using Microsoft.Azure.Management.Storage; +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- namespace Microsoft.WindowsAzure.Commands.Common.Storage { using System; + using System.Linq; + using System.Text; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Management.Storage; using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Auth; using Microsoft.WindowsAzure.Storage.Blob; using Microsoft.WindowsAzure.Storage.Table; - using Arm = Microsoft.Azure.Management.Storage; public class StorageUtilities { @@ -35,27 +44,24 @@ public static Uri CreateHttpsEndpoint(string endpointUri) /// /// Create a cloud storage account using an ARM storage management client /// - /// The client to use to get storage account details. - /// The resource group contining the storage account. + /// The adapter to ARM storage services. + /// The resource group containing the storage account. /// The name of the storage account. /// A CloudStorageAccount that can be used by windows azure storage library to manipulate objects in the storage account. - public static CloudStorageAccount GenerateCloudStorageAccount(Arm.IStorageManagementClient storageClient, + public static CloudStorageAccount GenerateCloudStorageAccount(IStorageServiceProvider provider, string resourceGroupName, string accountName) { if (!TestMockSupport.RunningMocked) { - var storageServiceResponse = storageClient.StorageAccounts.GetProperties(resourceGroupName, accountName); - Uri blobEndpoint = storageServiceResponse.StorageAccount.PrimaryEndpoints.Blob; - Uri queueEndpoint = storageServiceResponse.StorageAccount.PrimaryEndpoints.Queue; - Uri tableEndpoint = storageServiceResponse.StorageAccount.PrimaryEndpoints.Table; - Uri fileEndpoint = storageServiceResponse.StorageAccount.PrimaryEndpoints.File; + var service = provider.GetStorageService(accountName, resourceGroupName); + return new CloudStorageAccount( - GenerateStorageCredentials(storageClient, resourceGroupName, accountName), - blobEndpoint, - queueEndpoint, - tableEndpoint, - fileEndpoint); + new StorageCredentials(service.Name, service.AuthenticationKeys.First()), + service.BlobEndpoint, + service.QueueEndpoint, + service.TableEndpoint, + service.FileEndpoint); } else { @@ -64,7 +70,7 @@ public static CloudStorageAccount GenerateCloudStorageAccount(Arm.IStorageManage Convert.ToBase64String(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString()))), new Uri(string.Format("https://{0}.blob.core.windows.net", accountName)), new Uri(string.Format("https://{0}.queue.core.windows.net", accountName)), - new Uri(string.Format("https://{0}.table.core.windows.net", accountName)), + new Uri(string.Format("https://{0}.table.core.windows.net", accountName)), new Uri(string.Format("https://{0}.file.core.windows.net", accountName))); } } @@ -127,23 +133,22 @@ public static CloudStorageAccount GenerateCloudStorageAccount(IStorageManagement new Uri(string.Format("https://{0}.table.core.windows.net", accountName)), new Uri(string.Format("https://{0}.file.core.windows.net", accountName))); } - } + } /// /// Create storage credentials for the given account /// - /// The ARM storage management client. + /// The storage provider for ARM storage services. /// The resource group containing the storage account. /// The storage account name. /// Storage credentials for the given account. - public static StorageCredentials GenerateStorageCredentials(Arm.IStorageManagementClient storageClient, + public static StorageCredentials GenerateStorageCredentials(IStorageServiceProvider provider, string resourceGroupName, string accountName) { if (!TestMockSupport.RunningMocked) { - var storageKeysResponse = storageClient.StorageAccounts.ListKeys(resourceGroupName, accountName); - return new StorageCredentials(accountName, - storageKeysResponse.StorageAccountKeys.Key1); + var service = provider.GetStorageService(accountName, resourceGroupName); + return new StorageCredentials(accountName, service.AuthenticationKeys.First()); } else { @@ -158,8 +163,8 @@ public static StorageCredentials GenerateStorageCredentials(Arm.IStorageManageme /// The RDFE storage management client. /// The storage account name. /// Storage credentials for the given account. - public static StorageCredentials GenerateStorageCredentials(IStorageManagementClient storageClient, - string accountName) + public static StorageCredentials GenerateStorageCredentials(IStorageManagementClient storageClient, + string accountName) { if (!TestMockSupport.RunningMocked) { diff --git a/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj b/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj index a1178cb73435..ac72785c84c8 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj +++ b/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj @@ -168,6 +168,12 @@ + + Common\ARMStorageProvider.cs + + + Common\ARMStorageService.cs + Extension\DSC\DscExtensionCmdletConstants.cs @@ -196,6 +202,7 @@ + @@ -370,10 +377,6 @@ {e1f5201d-6067-430e-b303-4e367652991b} Commands.Resources - - {a50ab133-5c04-4a17-9054-f8343683ec23} - Commands.Management.Storage - {2493a8f7-1949-4f29-8d53-9d459046c3b8} Commands.Tags diff --git a/src/ResourceManager/Compute/Commands.Compute/Common/DiagnosticsHelper.cs b/src/ResourceManager/Compute/Commands.Compute/Common/DiagnosticsHelper.cs index e20acf7ff1e6..f395acb58bcd 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Common/DiagnosticsHelper.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Common/DiagnosticsHelper.cs @@ -318,8 +318,8 @@ public static string InitializeStorageAccountKey(IStorageManagementClient storag if (TryGetStorageAccount(storageClient, storageAccountName, out storageAccount)) { // Help user retrieve the storage account key - var psStorageAccount = new PSStorageAccount(storageAccount); - var credentials = StorageUtilities.GenerateStorageCredentials(storageClient, psStorageAccount.ResourceGroupName, psStorageAccount.StorageAccountName); + var credentials = StorageUtilities.GenerateStorageCredentials(new ARMStorageProvider(storageClient), + ARMStorageService.ParseResourceGroupFromId(storageAccount.Id), storageAccount.Name); storageAccountKey = credentials.ExportBase64EncodedKey(); } else diff --git a/src/ResourceManager/Compute/Commands.Compute/Common/StorageManagementClient.cs b/src/ResourceManager/Compute/Commands.Compute/Common/StorageManagementClient.cs new file mode 100644 index 000000000000..3fa53f64e691 --- /dev/null +++ b/src/ResourceManager/Compute/Commands.Compute/Common/StorageManagementClient.cs @@ -0,0 +1,40 @@ +// ---------------------------------------------------------------------------------- +// +// 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 System; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.Management.Storage; + +namespace Microsoft.Azure.Commands.Management.Storage +{ + public partial class StorageManagementClientWrapper + { + public IStorageManagementClient StorageManagementClient { get; set; } + + public Action VerboseLogger { get; set; } + + public Action ErrorLogger { get; set; } + + public StorageManagementClientWrapper(AzureContext context) + : this(AzureSession.ClientFactory.CreateClient(context, AzureEnvironment.Endpoint.ResourceManager)) + { + } + + public StorageManagementClientWrapper(IStorageManagementClient resourceManagementClient) + { + StorageManagementClient = resourceManagementClient; + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/Storage/Commands.Management.Storage/Commands.Management.Storage.csproj b/src/ResourceManager/Storage/Commands.Management.Storage/Commands.Management.Storage.csproj index 19aaecbf8be3..0f701466637f 100644 --- a/src/ResourceManager/Storage/Commands.Management.Storage/Commands.Management.Storage.csproj +++ b/src/ResourceManager/Storage/Commands.Management.Storage/Commands.Management.Storage.csproj @@ -135,6 +135,12 @@ + + Models\ARMStorageProvider.cs + + + Models\ARMStorageService.cs + diff --git a/src/ResourceManager/Storage/Commands.Management.Storage/Models/PSStorageAccount.cs b/src/ResourceManager/Storage/Commands.Management.Storage/Models/PSStorageAccount.cs index e3c9c1b08559..2b9340d4438f 100644 --- a/src/ResourceManager/Storage/Commands.Management.Storage/Models/PSStorageAccount.cs +++ b/src/ResourceManager/Storage/Commands.Management.Storage/Models/PSStorageAccount.cs @@ -79,7 +79,7 @@ public PSStorageAccount(StorageModels.StorageAccount storageAccount) public static PSStorageAccount Create(StorageModels.StorageAccount storageAccount, IStorageManagementClient client) { var result = new PSStorageAccount(storageAccount); - var credentials = StorageUtilities.GenerateStorageCredentials(client, result.ResourceGroupName, result.StorageAccountName); + var credentials = StorageUtilities.GenerateStorageCredentials(new ARMStorageProvider(client), result.ResourceGroupName, result.StorageAccountName); CloudStorageAccount account = new CloudStorageAccount(credentials, storageAccount.PrimaryEndpoints.Blob, storageAccount.PrimaryEndpoints.Queue, storageAccount.PrimaryEndpoints.Table, null); result.Context = new AzureStorageContext(account); diff --git a/src/ResourceManager/Storage/Commands.Management.Storage/StorageAccount/SetAzureRmCurrentStorageAccount.cs b/src/ResourceManager/Storage/Commands.Management.Storage/StorageAccount/SetAzureRmCurrentStorageAccount.cs index 0911ff6c8fb1..7dde7bf5de46 100644 --- a/src/ResourceManager/Storage/Commands.Management.Storage/StorageAccount/SetAzureRmCurrentStorageAccount.cs +++ b/src/ResourceManager/Storage/Commands.Management.Storage/StorageAccount/SetAzureRmCurrentStorageAccount.cs @@ -13,6 +13,7 @@ // ---------------------------------------------------------------------------------- using System.Management.Automation; +using Microsoft.Azure.Commands.Management.Storage.Models; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.Common.Storage; using Microsoft.WindowsAzure.Commands.Utilities.Common; @@ -51,7 +52,7 @@ public override void ExecuteCmdlet() } else { - account = StorageUtilities.GenerateCloudStorageAccount(StorageClient, ResourceGroupName, StorageAccountName); + account = StorageUtilities.GenerateCloudStorageAccount(new ARMStorageProvider(StorageClient), ResourceGroupName, StorageAccountName); } // Clear the current storage account for both SM and RM From 53dcccb48a8b6a0080c95b03862b4a715badcfe3 Mon Sep 17 00:00:00 2001 From: markcowl Date: Tue, 15 Mar 2016 23:00:12 -0700 Subject: [PATCH 2/4] Update msi for storage changes --- setup/azurecmdfiles.wxi | 200 ++++++++++++++++-- .../IStorageService.cs | 4 - 2 files changed, 188 insertions(+), 16 deletions(-) diff --git a/setup/azurecmdfiles.wxi b/setup/azurecmdfiles.wxi index 97c9d5032f27..6b568c350bd2 100644 --- a/setup/azurecmdfiles.wxi +++ b/setup/azurecmdfiles.wxi @@ -11,6 +11,9 @@ + + + @@ -127,6 +130,9 @@ + + + @@ -231,6 +237,9 @@ + + + @@ -299,6 +308,9 @@ + + + @@ -364,6 +376,9 @@ + + + @@ -441,6 +456,9 @@ + + + @@ -524,6 +542,9 @@ + + + @@ -634,9 +655,6 @@ - - - @@ -646,6 +664,9 @@ + + + @@ -673,12 +694,6 @@ - - - - - - @@ -822,6 +837,9 @@ + + + @@ -917,6 +935,9 @@ + + + @@ -950,6 +971,12 @@ + + + + + + @@ -997,6 +1024,9 @@ + + + @@ -1030,6 +1060,9 @@ + + + @@ -1083,6 +1116,9 @@ + + + @@ -1169,6 +1205,9 @@ + + + @@ -1255,6 +1294,9 @@ + + + @@ -1341,6 +1383,9 @@ + + + @@ -1478,6 +1523,9 @@ + + + @@ -1609,6 +1657,9 @@ + + + @@ -1746,6 +1797,9 @@ + + + @@ -1811,6 +1865,9 @@ + + + @@ -1891,6 +1948,9 @@ + + + @@ -1962,6 +2022,9 @@ + + + @@ -2030,6 +2093,9 @@ + + + @@ -2128,6 +2194,9 @@ + + + @@ -2229,6 +2298,9 @@ + + + @@ -2306,6 +2378,9 @@ + + + @@ -2449,6 +2524,9 @@ + + + @@ -2580,6 +2658,9 @@ + + + @@ -2666,6 +2747,9 @@ + + + @@ -2740,6 +2824,9 @@ + + + @@ -2805,6 +2892,9 @@ + + + @@ -2876,6 +2966,9 @@ + + + @@ -2984,6 +3077,9 @@ + + + @@ -3061,6 +3157,9 @@ + + + @@ -3180,6 +3279,9 @@ + + + @@ -3362,6 +3464,9 @@ + + + @@ -3442,6 +3547,9 @@ + + + @@ -3552,6 +3660,9 @@ + + + @@ -3713,6 +3824,9 @@ + + + @@ -4087,6 +4201,9 @@ + + + @@ -4169,6 +4286,9 @@ + + + @@ -4276,6 +4396,9 @@ + + + @@ -4662,6 +4785,9 @@ + + + @@ -4838,6 +4964,9 @@ + + + @@ -4918,6 +5047,9 @@ + + + @@ -5008,6 +5140,7 @@ + @@ -5046,6 +5179,7 @@ + @@ -5080,6 +5214,7 @@ + @@ -5102,6 +5237,7 @@ + @@ -5123,6 +5259,7 @@ + @@ -5148,6 +5285,7 @@ + @@ -5175,6 +5313,7 @@ + @@ -5211,10 +5350,10 @@ - + @@ -5224,8 +5363,6 @@ - - @@ -5273,6 +5410,7 @@ + @@ -5304,6 +5442,7 @@ + @@ -5315,6 +5454,8 @@ + + @@ -5330,6 +5471,7 @@ + @@ -5341,6 +5483,7 @@ + @@ -5358,6 +5501,7 @@ + @@ -5386,6 +5530,7 @@ + @@ -5414,6 +5559,7 @@ + @@ -5442,6 +5588,7 @@ + @@ -5487,6 +5634,7 @@ + @@ -5530,6 +5678,7 @@ + @@ -5575,6 +5724,7 @@ + @@ -5596,6 +5746,7 @@ + @@ -5622,6 +5773,7 @@ + @@ -5645,6 +5797,7 @@ + @@ -5667,6 +5820,7 @@ + @@ -5699,6 +5853,7 @@ + @@ -5732,6 +5887,7 @@ + @@ -5757,6 +5913,7 @@ + @@ -5804,6 +5961,7 @@ + @@ -5847,6 +6005,7 @@ + @@ -5875,6 +6034,7 @@ + @@ -5899,6 +6059,7 @@ + @@ -5920,6 +6081,7 @@ + @@ -5943,6 +6105,7 @@ + @@ -5977,6 +6140,7 @@ + @@ -6002,6 +6166,7 @@ + @@ -6041,6 +6206,7 @@ + @@ -6101,6 +6267,7 @@ + @@ -6127,6 +6294,7 @@ + @@ -6163,6 +6331,7 @@ + @@ -6216,6 +6385,7 @@ + @@ -6330,6 +6500,7 @@ + @@ -6356,6 +6527,7 @@ + @@ -6391,6 +6563,7 @@ + @@ -6509,6 +6682,7 @@ + @@ -6567,6 +6741,7 @@ + @@ -6593,6 +6768,7 @@ + diff --git a/src/Common/Commands.Common.Storage/IStorageService.cs b/src/Common/Commands.Common.Storage/IStorageService.cs index 9e94bd3216db..7d26eab73a11 100644 --- a/src/Common/Commands.Common.Storage/IStorageService.cs +++ b/src/Common/Commands.Common.Storage/IStorageService.cs @@ -14,10 +14,6 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.WindowsAzure.Storage.Auth; namespace Microsoft.WindowsAzure.Commands.Common.Storage { From 01e0fabf81588a3238fec38ea403182e9e13bcbc Mon Sep 17 00:00:00 2001 From: markcowl Date: Wed, 16 Mar 2016 11:58:04 -0700 Subject: [PATCH 3/4] Updating msi --- setup/azurecmdfiles.wxi | 224 ---------------------------------------- 1 file changed, 224 deletions(-) diff --git a/setup/azurecmdfiles.wxi b/setup/azurecmdfiles.wxi index 6b568c350bd2..f0055cc5f0a1 100644 --- a/setup/azurecmdfiles.wxi +++ b/setup/azurecmdfiles.wxi @@ -11,9 +11,6 @@ - - - @@ -32,9 +29,6 @@ - - - @@ -130,9 +124,6 @@ - - - @@ -169,9 +160,6 @@ - - - @@ -237,9 +225,6 @@ - - - @@ -308,9 +293,6 @@ - - - @@ -376,9 +358,6 @@ - - - @@ -456,9 +435,6 @@ - - - @@ -542,9 +518,6 @@ - - - @@ -664,9 +637,6 @@ - - - @@ -691,9 +661,6 @@ - - - @@ -837,9 +804,6 @@ - - - @@ -935,9 +899,6 @@ - - - @@ -971,12 +932,6 @@ - - - - - - @@ -1024,9 +979,6 @@ - - - @@ -1060,9 +1012,6 @@ - - - @@ -1116,9 +1065,6 @@ - - - @@ -1205,9 +1151,6 @@ - - - @@ -1294,9 +1237,6 @@ - - - @@ -1383,9 +1323,6 @@ - - - @@ -1523,9 +1460,6 @@ - - - @@ -1657,9 +1591,6 @@ - - - @@ -1797,9 +1728,6 @@ - - - @@ -1865,9 +1793,6 @@ - - - @@ -1948,9 +1873,6 @@ - - - @@ -2022,9 +1944,6 @@ - - - @@ -2093,9 +2012,6 @@ - - - @@ -2194,9 +2110,6 @@ - - - @@ -2298,9 +2211,6 @@ - - - @@ -2378,9 +2288,6 @@ - - - @@ -2524,9 +2431,6 @@ - - - @@ -2658,9 +2562,6 @@ - - - @@ -2747,9 +2648,6 @@ - - - @@ -2824,9 +2722,6 @@ - - - @@ -2892,9 +2787,6 @@ - - - @@ -2966,9 +2858,6 @@ - - - @@ -3077,9 +2966,6 @@ - - - @@ -3157,9 +3043,6 @@ - - - @@ -3178,9 +3061,6 @@ - - - @@ -3279,9 +3159,6 @@ - - - @@ -3300,9 +3177,6 @@ - - - @@ -3464,9 +3338,6 @@ - - - @@ -3547,9 +3418,6 @@ - - - @@ -3660,9 +3528,6 @@ - - - @@ -3687,9 +3552,6 @@ - - - @@ -3824,9 +3686,6 @@ - - - @@ -3845,9 +3704,6 @@ - - - @@ -4201,9 +4057,6 @@ - - - @@ -4286,9 +4139,6 @@ - - - @@ -4396,9 +4246,6 @@ - - - @@ -4417,9 +4264,6 @@ - - - @@ -4785,9 +4629,6 @@ - - - @@ -4806,9 +4647,6 @@ - - - @@ -4964,9 +4802,6 @@ - - - @@ -5047,9 +4882,6 @@ - - - @@ -5140,14 +4972,12 @@ - - @@ -5179,7 +5009,6 @@ - @@ -5192,7 +5021,6 @@ - @@ -5214,7 +5042,6 @@ - @@ -5237,7 +5064,6 @@ - @@ -5259,7 +5085,6 @@ - @@ -5285,7 +5110,6 @@ - @@ -5313,7 +5137,6 @@ - @@ -5353,7 +5176,6 @@ - @@ -5362,7 +5184,6 @@ - @@ -5410,7 +5231,6 @@ - @@ -5442,7 +5262,6 @@ - @@ -5454,8 +5273,6 @@ - - @@ -5471,7 +5288,6 @@ - @@ -5483,7 +5299,6 @@ - @@ -5501,7 +5316,6 @@ - @@ -5530,7 +5344,6 @@ - @@ -5559,7 +5372,6 @@ - @@ -5588,7 +5400,6 @@ - @@ -5634,7 +5445,6 @@ - @@ -5678,7 +5488,6 @@ - @@ -5724,7 +5533,6 @@ - @@ -5746,7 +5554,6 @@ - @@ -5773,7 +5580,6 @@ - @@ -5797,7 +5603,6 @@ - @@ -5820,7 +5625,6 @@ - @@ -5853,7 +5657,6 @@ - @@ -5887,7 +5690,6 @@ - @@ -5913,7 +5715,6 @@ - @@ -5961,7 +5762,6 @@ - @@ -6005,7 +5805,6 @@ - @@ -6034,7 +5833,6 @@ - @@ -6059,7 +5857,6 @@ - @@ -6081,7 +5878,6 @@ - @@ -6105,7 +5901,6 @@ - @@ -6140,7 +5935,6 @@ - @@ -6166,14 +5960,12 @@ - - @@ -6206,14 +5998,12 @@ - - @@ -6267,7 +6057,6 @@ - @@ -6294,7 +6083,6 @@ - @@ -6331,7 +6119,6 @@ - @@ -6340,7 +6127,6 @@ - @@ -6385,14 +6171,12 @@ - - @@ -6500,7 +6284,6 @@ - @@ -6527,7 +6310,6 @@ - @@ -6563,14 +6345,12 @@ - - @@ -6682,14 +6462,12 @@ - - @@ -6741,7 +6519,6 @@ - @@ -6768,7 +6545,6 @@ - From a070174e3aa8f3d225d11e9eb237088a702109d4 Mon Sep 17 00:00:00 2001 From: markcowl Date: Wed, 16 Mar 2016 15:44:21 -0700 Subject: [PATCH 4/4] Responding to review comments --- .../Adapters/ARM.Storage.3/ARMStorageService.cs | 15 ++++++++++++--- .../Commands.Common.Storage/IStorageService.cs | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Common/Commands.Common.Storage/Adapters/ARM.Storage.3/ARMStorageService.cs b/src/Common/Commands.Common.Storage/Adapters/ARM.Storage.3/ARMStorageService.cs index fd0da45ad8ec..d8be5246acb8 100644 --- a/src/Common/Commands.Common.Storage/Adapters/ARM.Storage.3/ARMStorageService.cs +++ b/src/Common/Commands.Common.Storage/Adapters/ARM.Storage.3/ARMStorageService.cs @@ -65,11 +65,20 @@ public List AuthenticationKeys get { return _authenticationKeys; } } - public static string ParseResourceGroupFromId(string idFromServer) + /// + /// Get the resource group name from a storage account resource Id + /// + /// The resource Id for the storage account + /// The resource group containing the storage account + public static string ParseResourceGroupFromId(string resourceId) { - if (!string.IsNullOrEmpty(idFromServer)) + if (!string.IsNullOrEmpty(resourceId)) { - string[] tokens = idFromServer.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] tokens = resourceId.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + if (tokens == null || tokens.Length < 4) + { + throw new ArgumentOutOfRangeException("resourceId"); + } return tokens[3]; } diff --git a/src/Common/Commands.Common.Storage/IStorageService.cs b/src/Common/Commands.Common.Storage/IStorageService.cs index 7d26eab73a11..9f85a3727a30 100644 --- a/src/Common/Commands.Common.Storage/IStorageService.cs +++ b/src/Common/Commands.Common.Storage/IStorageService.cs @@ -20,7 +20,7 @@ namespace Microsoft.WindowsAzure.Commands.Common.Storage public interface IStorageService { /// - /// The eblob service endpoint + /// The blob service endpoint /// Uri BlobEndpoint { get; }