Skip to content

Commit 7e29780

Browse files
author
Hovsep
committed
Merge pull request #1155 from hovsepm/TenantId
[#106171538] Changed Tenant to TenantId in cmdletst
2 parents bd1cfc2 + bc64d6b commit 7e29780

File tree

8 files changed

+55
-50
lines changed

8 files changed

+55
-50
lines changed

src/ResourceManager/Profile/Commands.Profile.Test/LoginCmdletTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void LoginWithSubscriptionAndTenant()
5050
// Setup
5151
cmdlt.CommandRuntime = commandRuntimeMock;
5252
cmdlt.SubscriptionId = "2c224e7e-3ef5-431d-a57b-e71f4662e3a6";
53-
cmdlt.Tenant = "72f988bf-86f1-41af-91ab-2d7cd011db47";
53+
cmdlt.TenantId = "72f988bf-86f1-41af-91ab-2d7cd011db47";
5454

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

7474
// Act
7575
cmdlt.InvokeBeginProcessing();
@@ -119,7 +119,7 @@ public void LoginWithNoSubscriptionAndTenant()
119119
var cmdlt = new AddAzureRMAccountCommand();
120120
// Setup
121121
cmdlt.CommandRuntime = commandRuntimeMock;
122-
cmdlt.Tenant = "72f988bf-86f1-41af-91ab-2d7cd011db47";
122+
cmdlt.TenantId = "72f988bf-86f1-41af-91ab-2d7cd011db47";
123123

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

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

src/ResourceManager/Profile/Commands.Profile.Test/TenantCmdletTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void GetTenantWithTenantParameter()
4949
var cmdlt = new GetAzureRMTenantCommand();
5050
// Setup
5151
cmdlt.CommandRuntime = commandRuntimeMock;
52-
cmdlt.Tenant = "72f988bf-86f1-41af-91ab-2d7cd011db47";
52+
cmdlt.TenantId = "72f988bf-86f1-41af-91ab-2d7cd011db47";
5353

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

7474
// Act
7575
Login("2c224e7e-3ef5-431d-a57b-e71f4662e3a6", null);
@@ -107,7 +107,7 @@ private void Login(string subscriptionId, string tenantId)
107107
// Setup
108108
cmdlt.CommandRuntime = commandRuntimeMock;
109109
cmdlt.SubscriptionId = subscriptionId;
110-
cmdlt.Tenant = tenantId;
110+
cmdlt.TenantId = tenantId;
111111

112112
// Act
113113
cmdlt.InvokeBeginProcessing();

src/ResourceManager/Profile/Commands.Profile/Account/AddAzureRmAccount.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ public class AddAzureRMAccountCommand : AzureRMCmdlet , IModuleAssemblyInitializ
4848
[Parameter(ParameterSetName = "User", Mandatory = false, HelpMessage = "Optional tenant name or ID")]
4949
[Parameter(ParameterSetName = "ServicePrincipal", Mandatory = true, HelpMessage = "TenantId name or ID")]
5050
[Parameter(ParameterSetName = "AccessToken", Mandatory = false, HelpMessage = "TenantId name or ID")]
51+
[Alias("Tenant")]
5152
[ValidateNotNullOrEmpty]
52-
public string Tenant { get; set; }
53+
public string TenantId { get; set; }
5354

5455
[Parameter(ParameterSetName = "AccessToken", Mandatory = true, HelpMessage = "AccessToken")]
5556
[ValidateNotNullOrEmpty]
@@ -126,9 +127,9 @@ protected override void ProcessRecord()
126127
password = Credential.Password;
127128
}
128129

129-
if (!string.IsNullOrEmpty(Tenant))
130+
if (!string.IsNullOrEmpty(TenantId))
130131
{
131-
azureAccount.SetProperty(AzureAccount.Property.Tenants, new[] { Tenant });
132+
azureAccount.SetProperty(AzureAccount.Property.Tenants, new[] { TenantId });
132133
}
133134

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

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

141-
WriteObject((PSAzureProfile)profileClient.Login(azureAccount, Environment, Tenant, SubscriptionId,
142+
WriteObject((PSAzureProfile)profileClient.Login(azureAccount, Environment, TenantId, SubscriptionId,
142143
SubscriptionName, password));
143144
}
144145

0 commit comments

Comments
 (0)