Skip to content

Merge pull request #129 from Azure/dev #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 1, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ public AzureRMProfile Login(AzureAccount account, AzureEnvironment environment,
// (tenant is not provided and subscription is not provided)
else
{
foreach(var tenant in ListAccountTenants(account, environment, password, promptBehavior))
foreach (var tenant in ListAccountTenants(account, environment, password, promptBehavior))
{
AzureTenant tempTenant;
AzureSubscription tempSubscription;
var token = AcquireAccessToken(account, environment, tenant.Id.ToString(), password,
ShowDialog.Auto);
if (newTenant == null && TryGetTenantSubscription(token, account, environment, tenant.Id.ToString(), subscriptionId, out tempSubscription, out tempTenant) &&
newTenant == null)
{
{
newTenant = tempTenant;
newSubscription = tempSubscription;
}
Expand All @@ -93,8 +93,8 @@ public AzureContext SetCurrentContext(string subscriptionId, string tenantId)
{
_profile.Context = new AzureContext(
_profile.Context.Subscription,
_profile.Context.Account,
_profile.Context.Environment,
_profile.Context.Account,
_profile.Context.Environment,
new AzureTenant() { Id = new Guid(tenantId) });

if (_profile.Context.Account != null)
Expand All @@ -107,10 +107,17 @@ public AzureContext SetCurrentContext(string subscriptionId, string tenantId)
}
}

if(!string.IsNullOrWhiteSpace(subscriptionId))
if (!string.IsNullOrWhiteSpace(subscriptionId))
{
if (ListSubscriptions(_profile.Context.Tenant.Id.ToString()).FirstOrDefault(s =>
String.Compare(s.Id.ToString(), subscriptionId, StringComparison.OrdinalIgnoreCase) == 0) == null)
{
throw new ArgumentException(string.Format(
"Provided subscription {0} does not exist under current tenant {1}", subscriptionId, _profile.Context.Tenant.Id));
}

var newSubscription = new AzureSubscription { Id = new Guid(subscriptionId) };
if(_profile.Context.Subscription != null)
if (_profile.Context.Subscription != null)
{
newSubscription.Account = _profile.Context.Subscription.Account;
newSubscription.Environment = _profile.Context.Subscription.Environment;
Expand All @@ -121,7 +128,7 @@ public AzureContext SetCurrentContext(string subscriptionId, string tenantId)
_profile.Context = new AzureContext(
newSubscription,
_profile.Context.Account,
_profile.Context.Environment,
_profile.Context.Environment,
_profile.Context.Tenant);
}

Expand All @@ -131,7 +138,7 @@ public AzureContext SetCurrentContext(string subscriptionId, string tenantId)
public List<AzureTenant> ListTenants(string tenant)
{
return ListAccountTenants(_profile.Context.Account, _profile.Context.Environment, null, ShowDialog.Auto)
.Where(t => tenant == null ||
.Where(t => tenant == null ||
tenant.Equals(t.Id.ToString(), StringComparison.OrdinalIgnoreCase) ||
tenant.Equals(t.Domain, StringComparison.OrdinalIgnoreCase))
.ToList();
Expand Down Expand Up @@ -279,7 +286,7 @@ private bool TryGetTenantSubscription(IAccessToken accessToken,
out AzureSubscription subscription,
out AzureTenant tenant)
{

using (var subscriptionClient = AzureSession.ClientFactory.CreateCustomClient<SubscriptionClient>(
new TokenCloudCredentials(accessToken.AccessToken),
environment.GetEndpointAsUri(AzureEnvironment.Endpoint.ResourceManager)))
Expand Down Expand Up @@ -339,15 +346,15 @@ private bool TryGetTenantSubscription(IAccessToken accessToken,

private List<AzureTenant> ListAccountTenants(AzureAccount account, AzureEnvironment environment, SecureString password, ShowDialog promptBehavior)
{
var commonTenantToken = AcquireAccessToken( account, environment, AuthenticationFactory.CommonAdTenant,
var commonTenantToken = AcquireAccessToken(account, environment, AuthenticationFactory.CommonAdTenant,
password, promptBehavior);

using (var subscriptionClient = AzureSession.ClientFactory.CreateCustomClient<SubscriptionClient>(
new TokenCloudCredentials(commonTenantToken.AccessToken),
environment.GetEndpointAsUri(AzureEnvironment.Endpoint.ResourceManager)))
{
return subscriptionClient.Tenants.List().TenantIds
.Select(ti => new AzureTenant() { Id = new Guid(ti.TenantId), Domain = commonTenantToken.GetDomain() } )
.Select(ti => new AzureTenant() { Id = new Guid(ti.TenantId), Domain = commonTenantToken.GetDomain() })
.ToList();
}
}
Expand All @@ -361,7 +368,7 @@ public IEnumerable<AzureTenant> ListTenants()
return ListAccountTenants(_profile.Context.Account, _profile.Context.Environment, null, ShowDialog.Never);
}

private IEnumerable<AzureSubscription> ListSubscriptionsForTenant(AzureAccount account, AzureEnvironment environment,
private IEnumerable<AzureSubscription> ListSubscriptionsForTenant(AzureAccount account, AzureEnvironment environment,
SecureString password, ShowDialog promptBehavior, string tenantId)
{
var accessToken = AcquireAccessToken(account, environment, tenantId, password, promptBehavior);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ public class Category
// Run Type
public const string RunType = "RunType";
public const string LiveOnly = "LiveOnly";
public const string Manual = "Manual";
//Uncomment when we need to tag on only run under mock
//public const string MockedOnly = "MockedOnly";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.Management.Network, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.10-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.11-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.Management.Storage, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Storage.2.4.0-preview\lib\net40\Microsoft.Azure.Management.Storage.dll</HintPath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<package id="Microsoft.Azure.Graph.RBAC" version="1.7.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Authorization" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Compute" version="8.2.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.10-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.11-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Resources" version="2.18.7-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Storage" version="2.4.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Test.Framework" version="1.0.5715.36130-prerelease" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.Management.Network, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.10-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.11-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.Management.Storage, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Storage.2.4.0-preview\lib\net40\Microsoft.Azure.Management.Storage.dll</HintPath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Authorization" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Compute" version="8.2.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.10-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.11-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Resources" version="2.18.7-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Storage" version="2.4.0-preview" targetFramework="net45" />
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
Expand Down
4 changes: 4 additions & 0 deletions src/ResourceManager/HDInsight/.nuget/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="xunit.runner.console" version="2.0.0" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
<package id="Microsoft.Rest.ClientRuntime" version="1.2.0" targetFramework="net45" />
<package id="Microsoft.Rest.ClientRuntime.Azure.Authentication" version="0.9.3" targetFramework="net45" />
<package id="Moq" version="4.2.1402.2112" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
<package id="xunit" version="1.9.2" targetFramework="net45" />
<package id="xunit.extensions" version="1.9.2" targetFramework="net45" />
<package id="xunit.runner.visualstudio" version="2.1.0-beta4-build1109" targetFramework="net45" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.1.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.Network, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.10-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.11-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down Expand Up @@ -299,6 +299,12 @@
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.LoadBalancerTests\TestLoadBalancerSet.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.LoadBalancerTests\TestLoadBalancerInboundNatPoolConfigCRUDPublicLB.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.LoadBalancerTests\TestLoadBalancerInboundNatPoolConfigInternalLB.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.NetworkSecurityGroupTests\TestNetworkSecurityGroupCRUD.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,19 @@ public void TestLoadBalancerNicAssociationDuringCreate()
{
NetworkResourcesController.NewInstance.RunPsTest("Test-LoadBalancer-NicAssociationDuringCreate");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestLoadBalancerInboundNatPoolConfigInternalLB()
{
NetworkResourcesController.NewInstance.RunPsTest("Test-LoadBalancerInboundNatPoolConfigCRUD-InternalLB");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestLoadBalancerInboundNatPoolConfigCRUDPublicLB()
{
NetworkResourcesController.NewInstance.RunPsTest("Test-LoadBalancerInboundNatPoolConfigCRUD-PublicLB");
}
}
}
Loading