Skip to content

Commit 92b77e7

Browse files
committed
Merge branch 'dev' of https://github.com/Azure/azure-powershell into Policy
2 parents e43a1f0 + 390d35b commit 92b77e7

File tree

176 files changed

+5749
-4381
lines changed

Some content is hidden

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

176 files changed

+5749
-4381
lines changed

AzurePowershell.Test.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
<XUnitTests Include=".\src\ResourceManager\TrafficManager\Commands.TrafficManager2.Test\bin\Debug\Microsoft.Azure.Commands.TrafficManager.Test.ScenarioTests.dll"/>
6868
<XUnitTests Include=".\src\ServiceManagement\Network\Commands.Network.Test\bin\Debug\Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Test.dll"/>
6969
<XUnitTests Include=".\src\ResourceManager\ApiManagement\Commands.ApiManagement.Test\bin\Debug\Microsoft.Azure.Commands.ApiManagement.Test.dll"/>
70+
<XUnitTests Include=".\src\Common\Commands.ResourceManager.Profile.Test\bin\Debug\Microsoft.Azure.Commands.Profile.Test.dll"/>
7071
</ItemGroup>
7172

7273
<Target Name="InvokeMSTest">

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,17 @@
5757
<HintPath>..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll</HintPath>
5858
</Reference>
5959
<Reference Include="Microsoft.Azure.Common.Authentication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
60-
<SpecificVersion>False</SpecificVersion>
6160
<HintPath>..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
61+
<Private>True</Private>
6262
</Reference>
6363
<Reference Include="Microsoft.Azure.Common.NetFramework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6464
<SpecificVersion>False</SpecificVersion>
6565
<HintPath>..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
6666
</Reference>
67+
<Reference Include="Microsoft.Azure.KeyVault.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
68+
<HintPath>..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll</HintPath>
69+
<Private>True</Private>
70+
</Reference>
6771
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6872
<SpecificVersion>False</SpecificVersion>
6973
<HintPath>..\..\packages\Microsoft.Azure.Management.Resources.2.18.7-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>

src/Common/Commands.Common.Storage/packages.config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<package id="Microsoft.Azure.Common" version="2.1.0" targetFramework="net45" />
55
<package id="Microsoft.Azure.Common.Authentication" version="1.3.0-preview" targetFramework="net45" />
66
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
7+
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
78
<package id="Microsoft.Azure.Management.Resources" version="2.18.7-preview" targetFramework="net45" />
89
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
910
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />
@@ -21,4 +22,4 @@
2122
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
2223
<package id="System.Spatial" version="5.6.4" targetFramework="net45" />
2324
<package id="WindowsAzure.Storage" version="5.0.0" targetFramework="net45" />
24-
</packages>
25+
</packages>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@
6464
<HintPath>..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll</HintPath>
6565
</Reference>
6666
<Reference Include="Microsoft.Azure.Common.Authentication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
67-
<SpecificVersion>False</SpecificVersion>
6867
<HintPath>..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
68+
<Private>True</Private>
6969
</Reference>
7070
<Reference Include="Microsoft.Azure.Common.NetFramework">
7171
<SpecificVersion>False</SpecificVersion>

src/Common/Commands.Common/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
<package id="Microsoft.Rest.ClientRuntime.Azure.Authentication" version="0.9.3" targetFramework="net45" />
1717
<package id="Microsoft.WindowsAzure.Management" version="4.1.1" targetFramework="net45" />
1818
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
19-
</packages>
19+
</packages>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using Microsoft.Azure.Common.Authentication;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace Microsoft.Azure.Commands.ResourceManager.Common
9+
{
10+
public static class AccessTokenExtensions
11+
{
12+
public static string GetDomain(this IAccessToken token)
13+
{
14+
if( token != null && token.UserId !=null && token.UserId.Contains('@'))
15+
{
16+
return token.UserId.Split(
17+
new[] { '@' },
18+
StringSplitOptions.RemoveEmptyEntries).Last();
19+
}
20+
21+
return null;
22+
}
23+
}
24+
}

src/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@
6161
<HintPath>..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll</HintPath>
6262
</Reference>
6363
<Reference Include="Microsoft.Azure.Common.Authentication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
64-
<SpecificVersion>False</SpecificVersion>
6564
<HintPath>..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
65+
<Private>True</Private>
6666
</Reference>
6767
<Reference Include="Microsoft.Azure.Common.NetFramework">
6868
<SpecificVersion>False</SpecificVersion>
@@ -182,7 +182,9 @@
182182
<Compile Include="..\Commands.Common\TestMockSupport.cs">
183183
<Link>Common\TestMockSupport.cs</Link>
184184
</Compile>
185+
<Compile Include="AccessTokenExtensions.cs" />
185186
<Compile Include="AzureRMCmdlet.cs" />
187+
<Compile Include="ModelExtensions.cs" />
186188
<Compile Include="Properties\AssemblyInfo.cs" />
187189
<Compile Include="Properties\Resources.Designer.cs">
188190
<AutoGen>True</AutoGen>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using Microsoft.Azure.Common.Authentication.Models;
7+
using Microsoft.Azure.Subscriptions.Models;
8+
9+
namespace Microsoft.Azure.Commands.ResourceManager.Common
10+
{
11+
public static class ModelExtensions
12+
{
13+
14+
public static AzureSubscription ToAzureSubscription(this Subscription other, AzureContext context)
15+
{
16+
var subscription = new AzureSubscription();
17+
subscription.Account = context.Account != null ? context.Account.Id : null;
18+
subscription.Environment = context.Environment != null ? context.Environment.Name : EnvironmentName.AzureCloud;
19+
subscription.Id = new Guid(other.SubscriptionId);
20+
subscription.Name = other.DisplayName;
21+
subscription.SetProperty(AzureSubscription.Property.Tenants,
22+
context.Tenant.Id.ToString());
23+
return subscription;
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)