Skip to content

Commit 6af0ac7

Browse files
committed
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
# Conflicts: # src/ResourceManager/Compute/Commands.Compute.Test/SessionRecords/Microsoft.Azure.Commands.Compute.Test.ScenarioTests.DiagnosticsExtensionTests/TestDiagnosticsExtensionBasic.json # src/ResourceManager/Compute/Commands.Compute.Test/SessionRecords/Microsoft.Azure.Commands.Compute.Test.ScenarioTests.DiagnosticsExtensionTests/TestDiagnosticsExtensionSepcifyStorageAccountName.json # src/ResourceManager/Compute/Commands.Compute.Test/SessionRecords/Microsoft.Azure.Commands.Compute.Test.ScenarioTests.DiagnosticsExtensionTests/TestDiagnosticsExtensionSupportJsonConfig.json # src/ResourceManager/Compute/Commands.Compute.Test/packages.config # src/ResourceManager/Compute/Commands.Compute/packages.config
2 parents 8a59316 + c0b3a75 commit 6af0ac7

File tree

626 files changed

+23655
-10271
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

626 files changed

+23655
-10271
lines changed

build.proj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,15 @@
4545
<Scope Condition=" $(Scope) == '' " >all</Scope>
4646
</PropertyGroup>
4747
<ItemGroup>
48-
<CmdletSolutionsToBuild Include=".\src\ResourceManager\**\*.sln;.\src\ServiceManagement\ServiceManagement.sln"
48+
<CmdletSolutionsToBuild Include=".\src\ResourceManager\**\*.sln;.\src\ServiceManagement\ServiceManagement.sln;.\src\Storage\Storage.sln"
4949
Exclude=".\src\ResourceManager\Intune\*.sln"
5050
Condition=" '$(Scope)' == 'all' "/>
5151
<CmdletSolutionsToBuild Include=".\src\ResourceManager\$(Scope)\*.sln"
5252
Condition=" '$(Scope)' != 'all' and '$(Scope)' != 'ServiceManagement' and '$(Scope)' != 'AzureStorage' "/>
5353
<CmdletSolutionsToBuild Include=".\src\ServiceManagement\ServiceManagement.sln"
54-
Condition=" '$(Scope)' == 'ServiceManagement' or '$(Scope)' == 'AzureStorage' "/>
54+
Condition=" '$(Scope)' == 'ServiceManagement'"/>
55+
<CmdletSolutionsToBuild Include=".\src\Storage\Storage.sln"
56+
Condition=" '$(Scope)' == 'AzureStorage' "/>
5557
<SetupSln Include=".\setup\azurepowershell.sln" />
5658
<StaticAnalysis Include=".\tools\StaticAnalysis\StaticAnalysis.sln" />
5759
</ItemGroup>

setup/azurecmd.wxs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
<Component Id="PSModulePath.System" Guid="273525B9-7AAB-421A-90C8-8E50A1840B8D">
7676
<CreateFolder />
7777
<!-- Work around bug that PowerShell does not always consider default module paths. -->
78-
<Environment Id="PSModulePath.SystemAppRoot" Action="set" Name="PSMODULEPATH" Part="last" Value="[BaseModulesFolder];[PowerShellFolder]ResourceManager\AzureResourceManager\;[PowerShellFolder]ServiceManagement\" System="yes" />
78+
<Environment Id="PSModulePath.SystemAppRoot" Action="set" Name="PSMODULEPATH" Part="last" Value="[BaseModulesFolder];[PowerShellFolder]ResourceManager\AzureResourceManager\;[PowerShellFolder]ServiceManagement\;[PowerShellFolder]\Storage" System="yes" />
7979
</Component>
8080
</DirectoryRef>
8181

setup/azurecmdfiles.wxi

Lines changed: 144 additions & 352 deletions
Large diffs are not rendered by default.

src/Common/Commands.Common.Authentication.Test/Commands.Common.Authentication.Test.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@
6868
<Private>True</Private>
6969
</Reference>
7070
<Reference Include="Microsoft.Rest.ClientRuntime">
71-
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\portable-net45+win+wpa81\Microsoft.Rest.ClientRuntime.dll</HintPath>
71+
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.1.0\lib\portable-net45+win+wpa81\Microsoft.Rest.ClientRuntime.dll</HintPath>
7272
<Private>True</Private>
7373
</Reference>
7474
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
75-
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.0.2\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
75+
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.1.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
7676
<Private>True</Private>
7777
</Reference>
7878
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication">

src/Common/Commands.Common.Authentication.Test/packages.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />
99
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.18.206251556" targetFramework="net45" />
1010
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
11-
<package id="Microsoft.Rest.ClientRuntime" version="2.0.1" targetFramework="net45" />
12-
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.0.2" targetFramework="net45" />
11+
<package id="Microsoft.Rest.ClientRuntime" version="2.1.0" targetFramework="net45" />
12+
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.1.0" targetFramework="net45" />
1313
<package id="Microsoft.Rest.ClientRuntime.Azure.Authentication" version="2.0.1-preview" targetFramework="net45" />
1414
<package id="Microsoft.WindowsAzure.Management.Storage" version="5.1.1" targetFramework="net45" />
1515
<package id="Moq" version="4.2.1510.2205" targetFramework="net45" />

src/Common/Commands.Common.Authentication/Commands.Common.Authentication.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@
7272
<Private>True</Private>
7373
</Reference>
7474
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
75-
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll</HintPath>
75+
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.1.0\lib\net45\Microsoft.Rest.ClientRuntime.dll</HintPath>
7676
<Private>True</Private>
7777
</Reference>
7878
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
79-
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.0.2\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
79+
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.1.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
8080
<Private>True</Private>
8181
</Reference>
8282
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

src/Common/Commands.Common.Authentication/packages.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />
99
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.18.206251556" targetFramework="net45" />
1010
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
11-
<package id="Microsoft.Rest.ClientRuntime" version="2.0.1" targetFramework="net45" />
12-
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.0.2" targetFramework="net45" />
11+
<package id="Microsoft.Rest.ClientRuntime" version="2.1.0" targetFramework="net45" />
12+
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.1.0" targetFramework="net45" />
1313
<package id="Microsoft.Rest.ClientRuntime.Azure.Authentication" version="2.0.1-preview" targetFramework="net45" />
1414
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
1515
</packages>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System.Management.Automation;
16+
using Microsoft.Azure.Management.Storage;
17+
using Microsoft.WindowsAzure.Commands.Common.Storage;
18+
19+
namespace Microsoft.Azure.Commands.Management.Storage.Models
20+
{
21+
public class ARMStorageProvider : IStorageServiceProvider
22+
{
23+
IStorageManagementClient _client;
24+
25+
public ARMStorageProvider(IStorageManagementClient client)
26+
{
27+
_client = client;
28+
}
29+
public IStorageService GetStorageService(string name, string resourceGroupName)
30+
{
31+
var account = _client.StorageAccounts.GetProperties(resourceGroupName, name);
32+
var keys = _client.StorageAccounts.ListKeys(resourceGroupName, name);
33+
return new ARMStorageService(account.StorageAccount, keys.StorageAccountKeys.Key1,
34+
keys.StorageAccountKeys.Key2);
35+
}
36+
}
37+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
16+
using System.Collections.Generic;
17+
using System.Linq;
18+
using System.Text;
19+
using System.Threading.Tasks;
20+
using Microsoft.WindowsAzure.Commands.Common.Storage;
21+
22+
namespace Microsoft.Azure.Commands.Management.Storage.Models
23+
{
24+
public class ARMStorageService : IStorageService
25+
{
26+
Azure.Management.Storage.Models.StorageAccount _account;
27+
List<string> _authenticationKeys = new List<string>();
28+
public ARMStorageService(Azure.Management.Storage.Models.StorageAccount account,
29+
params string[] authenticationKeys)
30+
{
31+
_account = account;
32+
foreach (var key in authenticationKeys)
33+
{
34+
_authenticationKeys.Add(key);
35+
}
36+
}
37+
38+
public Uri BlobEndpoint
39+
{
40+
get { return _account.PrimaryEndpoints.Blob; }
41+
}
42+
43+
public Uri FileEndpoint
44+
{
45+
get { return _account.PrimaryEndpoints.File; }
46+
}
47+
48+
public Uri QueueEndpoint
49+
{
50+
get { return _account.PrimaryEndpoints.Queue; }
51+
}
52+
53+
public Uri TableEndpoint
54+
{
55+
get { return _account.PrimaryEndpoints.Table; }
56+
}
57+
58+
public string Name
59+
{
60+
get { return _account.Name; }
61+
}
62+
63+
public List<string> AuthenticationKeys
64+
{
65+
get { return _authenticationKeys; }
66+
}
67+
68+
/// <summary>
69+
/// Get the resource group name from a storage account resource Id
70+
/// </summary>
71+
/// <param name="resourceId">The resource Id for the storage account</param>
72+
/// <returns>The resource group containing the storage account</returns>
73+
public static string ParseResourceGroupFromId(string resourceId)
74+
{
75+
if (!string.IsNullOrEmpty(resourceId))
76+
{
77+
string[] tokens = resourceId.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
78+
if (tokens == null || tokens.Length < 4)
79+
{
80+
throw new ArgumentOutOfRangeException("resourceId");
81+
}
82+
83+
return tokens[3];
84+
}
85+
86+
return null;
87+
}
88+
89+
}
90+
}

src/Common/Commands.Common.Storage/AzureContextExtensions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
using Microsoft.Azure.Commands.Common.Authentication.Models;
1616
using Microsoft.WindowsAzure.Commands.Common.Storage;
17-
using ArmStorage = Microsoft.Azure.Management.Storage;
1817
using SmStorage = Microsoft.WindowsAzure.Management.Storage;
1918
using Microsoft.WindowsAzure.Storage;
2019

src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@
6363
<HintPath>..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll</HintPath>
6464
<Private>True</Private>
6565
</Reference>
66-
<Reference Include="Microsoft.Azure.Management.Storage, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
67-
<SpecificVersion>False</SpecificVersion>
68-
<HintPath>..\..\packages\Microsoft.Azure.Management.Storage.3.0.0\lib\net40\Microsoft.Azure.Management.Storage.dll</HintPath>
69-
</Reference>
7066
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
7167
<SpecificVersion>False</SpecificVersion>
7268
<HintPath>..\..\packages\Microsoft.Azure.Management.Resources.2.19.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>
@@ -92,7 +88,7 @@
9288
<HintPath>..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll</HintPath>
9389
</Reference>
9490
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
95-
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll</HintPath>
91+
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.1.0\lib\net45\Microsoft.Rest.ClientRuntime.dll</HintPath>
9692
<Private>True</Private>
9793
</Reference>
9894
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
@@ -162,6 +158,8 @@
162158
<Compile Include="BlobUploadParameters.cs" />
163159
<Compile Include="IStorageClientWrapper.cs" />
164160
<Compile Include="IStorageContextProvider.cs" />
161+
<Compile Include="IStorageService.cs" />
162+
<Compile Include="IStorageServiceProvider.cs" />
165163
<Compile Include="Properties\Resources.Designer.cs">
166164
<AutoGen>True</AutoGen>
167165
<DesignTime>True</DesignTime>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
16+
using System.Collections.Generic;
17+
18+
namespace Microsoft.WindowsAzure.Commands.Common.Storage
19+
{
20+
public interface IStorageService
21+
{
22+
/// <summary>
23+
/// The blob service endpoint
24+
/// </summary>
25+
Uri BlobEndpoint { get; }
26+
27+
/// <summary>
28+
/// The file service endpoint
29+
/// </summary>
30+
Uri FileEndpoint { get; }
31+
32+
/// <summary>
33+
/// The queue service endpoint
34+
/// </summary>
35+
Uri QueueEndpoint { get; }
36+
37+
/// <summary>
38+
/// The table service endpoint
39+
/// </summary>
40+
Uri TableEndpoint { get; }
41+
42+
/// <summary>
43+
/// The storage account name
44+
/// </summary>
45+
string Name { get;}
46+
47+
/// <summary>
48+
/// Authentication keys for the storage account
49+
/// </summary>
50+
List<string> AuthenticationKeys { get; }
51+
}
52+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
16+
using System.Collections.Generic;
17+
using System.Linq;
18+
using System.Text;
19+
using System.Threading.Tasks;
20+
21+
namespace Microsoft.WindowsAzure.Commands.Common.Storage
22+
{
23+
public interface IStorageServiceProvider
24+
{
25+
IStorageService GetStorageService(string name, string resourceGroupName);
26+
}
27+
}

src/Common/Commands.Common.Storage/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@
2424
[assembly: ComVisible(false)]
2525
[assembly: CLSCompliant(false)]
2626
[assembly: Guid("c565107e-98a9-4703-85cd-a7efc3d8da7b")]
27-
[assembly: AssemblyVersion("1.0.0")]
28-
[assembly: AssemblyFileVersion("1.0.0")]
27+
[assembly: AssemblyVersion("1.0.5")]
28+
[assembly: AssemblyFileVersion("1.0.5")]

0 commit comments

Comments
 (0)