Skip to content

[#106171538] Changed Tenant to TenantId in cmdletst #1155

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 3 commits into from
Oct 23, 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 @@ -50,7 +50,7 @@ public void LoginWithSubscriptionAndTenant()
// Setup
cmdlt.CommandRuntime = commandRuntimeMock;
cmdlt.SubscriptionId = "2c224e7e-3ef5-431d-a57b-e71f4662e3a6";
cmdlt.Tenant = "72f988bf-86f1-41af-91ab-2d7cd011db47";
cmdlt.TenantId = "72f988bf-86f1-41af-91ab-2d7cd011db47";

// Act
cmdlt.InvokeBeginProcessing();
Expand All @@ -69,7 +69,7 @@ public void LoginWithInvalidSubscriptionAndTenantThrowsCloudException()
// Setup
cmdlt.CommandRuntime = commandRuntimeMock;
cmdlt.SubscriptionId = "2c224e7e-3ef5-431d-a57b-e71f4662e3a5";
cmdlt.Tenant = "72f988bf-86f1-41af-91ab-2d7cd011db47";
cmdlt.TenantId = "72f988bf-86f1-41af-91ab-2d7cd011db47";

// Act
cmdlt.InvokeBeginProcessing();
Expand Down Expand Up @@ -119,7 +119,7 @@ public void LoginWithNoSubscriptionAndTenant()
var cmdlt = new AddAzureRMAccountCommand();
// Setup
cmdlt.CommandRuntime = commandRuntimeMock;
cmdlt.Tenant = "72f988bf-86f1-41af-91ab-2d7cd011db47";
cmdlt.TenantId = "72f988bf-86f1-41af-91ab-2d7cd011db47";

// Act
cmdlt.InvokeBeginProcessing();
Expand All @@ -137,7 +137,7 @@ public void LoginWithSubscriptionname()
var cmdlt = new AddAzureRMAccountCommand();
// Setup
cmdlt.CommandRuntime = commandRuntimeMock;
cmdlt.Tenant = "72f988bf-86f1-41af-91ab-2d7cd011db47";
cmdlt.TenantId = "72f988bf-86f1-41af-91ab-2d7cd011db47";
cmdlt.SubscriptionName = "Node CLI Test";

// Act
Expand All @@ -156,7 +156,7 @@ public void LoginWithBothSubscriptionIdAndNameThrowsCloudException()
var cmdlt = new AddAzureRMAccountCommand();
// Setup
cmdlt.CommandRuntime = commandRuntimeMock;
cmdlt.Tenant = "72f988bf-86f1-41af-91ab-2d7cd011db47";
cmdlt.TenantId = "72f988bf-86f1-41af-91ab-2d7cd011db47";
cmdlt.SubscriptionName = "Node CLI Test";
cmdlt.SubscriptionId = "2c224e7e-3ef5-431d-a57b-e71f4662e3a6";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void GetTenantWithTenantParameter()
var cmdlt = new GetAzureRMTenantCommand();
// Setup
cmdlt.CommandRuntime = commandRuntimeMock;
cmdlt.Tenant = "72f988bf-86f1-41af-91ab-2d7cd011db47";
cmdlt.TenantId = "72f988bf-86f1-41af-91ab-2d7cd011db47";

// Act
Login("2c224e7e-3ef5-431d-a57b-e71f4662e3a6", null);
Expand All @@ -69,7 +69,7 @@ public void GetTenantWithDomainParameter()
var cmdlt = new GetAzureRMTenantCommand();
// Setup
cmdlt.CommandRuntime = commandRuntimeMock;
cmdlt.Tenant = "microsoft.com";
cmdlt.TenantId = "microsoft.com";

// Act
Login("2c224e7e-3ef5-431d-a57b-e71f4662e3a6", null);
Expand Down Expand Up @@ -107,7 +107,7 @@ private void Login(string subscriptionId, string tenantId)
// Setup
cmdlt.CommandRuntime = commandRuntimeMock;
cmdlt.SubscriptionId = subscriptionId;
cmdlt.Tenant = tenantId;
cmdlt.TenantId = tenantId;

// Act
cmdlt.InvokeBeginProcessing();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ public class AddAzureRMAccountCommand : AzureRMCmdlet , IModuleAssemblyInitializ
[Parameter(ParameterSetName = "User", Mandatory = false, HelpMessage = "Optional tenant name or ID")]
[Parameter(ParameterSetName = "ServicePrincipal", Mandatory = true, HelpMessage = "TenantId name or ID")]
[Parameter(ParameterSetName = "AccessToken", Mandatory = false, HelpMessage = "TenantId name or ID")]
[Alias("Tenant")]
[ValidateNotNullOrEmpty]
public string Tenant { get; set; }
public string TenantId { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this is the only cmdlet that has parameter name as TenantId and alias as Tenant while others are vice versa?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We left Tenant for ASM with alias TenantId and did the opposite for ARM.


[Parameter(ParameterSetName = "AccessToken", Mandatory = true, HelpMessage = "AccessToken")]
[ValidateNotNullOrEmpty]
Expand Down Expand Up @@ -126,9 +127,9 @@ protected override void ProcessRecord()
password = Credential.Password;
}

if (!string.IsNullOrEmpty(Tenant))
if (!string.IsNullOrEmpty(TenantId))
{
azureAccount.SetProperty(AzureAccount.Property.Tenants, new[] { Tenant });
azureAccount.SetProperty(AzureAccount.Property.Tenants, new[] { TenantId });
}

if( AzureRmProfileProvider.Instance.Profile == null)
Expand All @@ -138,7 +139,7 @@ protected override void ProcessRecord()

var profileClient = new RMProfileClient(AzureRmProfileProvider.Instance.Profile);

WriteObject((PSAzureProfile)profileClient.Login(azureAccount, Environment, Tenant, SubscriptionId,
WriteObject((PSAzureProfile)profileClient.Login(azureAccount, Environment, TenantId, SubscriptionId,
SubscriptionName, password));
}

Expand Down
Loading