Skip to content

Commit 20c0944

Browse files
committed
Remove Directory property from Tenant
1 parent 21b5b5a commit 20c0944

File tree

6 files changed

+7
-32
lines changed

6 files changed

+7
-32
lines changed

src/Authentication.Abstractions/Extensions/AzureTenantExtensions.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public static void CopyFrom(this IAzureTenant tenant, IAzureTenant other)
3838
if (tenant != null && other != null)
3939
{
4040
tenant.Id = other.Id;
41-
tenant.Directory = other.Directory;
4241
tenant.CopyPropertiesFrom(other);
4342
}
4443
}
@@ -52,7 +51,6 @@ public static void Update(this IAzureTenant tenant, IAzureTenant other)
5251
{
5352
if (tenant != null && other != null)
5453
{
55-
tenant.Directory = other.Directory?? tenant.Directory;
5654
tenant.UpdateProperties(other);
5755
}
5856
}

src/Authentication.Abstractions/Interfaces/IAzureTenant.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,5 @@ public interface IAzureTenant : IExtensibleModel
2323
/// The Tenant Identifier (GUID)
2424
/// </summary>
2525
string Id { get; set; }
26-
27-
/// <summary>
28-
/// The dns name of the tenant directory (domain)
29-
/// </summary>
30-
string Directory { get; set; }
3126
}
3227
}

src/Authentication.ResourceManager/Models/PSAzureTenant.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ public PSAzureTenant(PSObject other)
8282
}
8383

8484
this.Id = other.GetProperty<string>(nameof(Id));
85-
this.Directory = other.GetProperty<string>(nameof(Directory));
8685
this.PopulateExtensions(other);
8786
}
8887
/// <summary>
@@ -91,12 +90,6 @@ public PSAzureTenant(PSObject other)
9190
[Ps1Xml(Label = "Id", Target = ViewControl.Table, Position = 0)]
9291
public string Id { get; set; }
9392

94-
/// <summary>
95-
/// The name of the subscription.
96-
/// </summary>
97-
[Ps1Xml(Label = "Directory", Target = ViewControl.Table, Position = 1)]
98-
public string Directory { get; set; }
99-
10093
/// <summary>
10194
/// For legacy support - the tenant id
10295
/// </summary>
@@ -110,7 +103,7 @@ public PSAzureTenant(PSObject other)
110103

111104
public override string ToString()
112105
{
113-
return (this.Id == Guid.Empty.ToString()) ? this.Directory : this.Id;
106+
return this.Id;
114107
}
115108
}
116109
}

src/Authentication.Test/Cmdlets/ConnectAccount.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,6 @@ private bool TryGetTenantSubscription(IAccessToken accessToken,
594594

595595
tenant = new AzureTenant();
596596
tenant.Id = accessToken.TenantId;
597-
tenant.Directory = accessToken.GetDomain();
598597
return true;
599598
}
600599

@@ -604,14 +603,6 @@ private bool TryGetTenantSubscription(IAccessToken accessToken,
604603
{
605604
tenant = new AzureTenant();
606605
tenant.Id = accessToken.TenantId;
607-
if (accessToken.UserId != null)
608-
{
609-
var domain = accessToken.UserId.Split(new[] { '@' }, StringSplitOptions.RemoveEmptyEntries);
610-
if (domain.Length == 2)
611-
{
612-
tenant.Directory = domain[1];
613-
}
614-
}
615606
return true;
616607
}
617608

src/ScenarioTest.ResourceManager/Extensions/TestModelExtensions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ public static bool CheckExtensionsEqual(this IExtensibleModel model, IExtensible
4141
public static bool IsEqual(this IAzureTenant baseTenant, IAzureTenant other)
4242
{
4343
return (baseTenant == null && other == null) || (baseTenant.CheckExtensionsEqual(other)
44-
&& string.Equals(baseTenant.Directory, other.Directory, StringComparison.OrdinalIgnoreCase)
4544
&& string.Equals(baseTenant.Id, other.Id, StringComparison.OrdinalIgnoreCase));
4645
}
4746

src/TestFx/TestManager.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public class TestManager : ITestRunnerFactory, ITestRunner
5454
/// <returns></returns>
5555
public static ITestRunnerFactory CreateInstance(ITestOutputHelper output, [CallerFilePath] string callerFilePath = null)
5656
{
57-
var callingClassName = string.IsNullOrEmpty(callerFilePath)
57+
var callingClassName = string.IsNullOrEmpty(callerFilePath)
5858
? null
5959
: Path.GetFileNameWithoutExtension(callerFilePath);
6060
return new TestManager(callingClassName).WithTestOutputHelper(output);
@@ -82,7 +82,7 @@ protected TestManager(string callingClassName)
8282
#region Builder impl
8383

8484
/// <summary>
85-
/// Sets a name of the subfolder where a test project keeps tests
85+
/// Sets a name of the subfolder where a test project keeps tests
8686
/// </summary>
8787
/// <param name="folderName"></param>
8888
/// <returns>self</returns>
@@ -128,7 +128,7 @@ public ITestRunnerFactory WithExtraRmModules(Func<EnvironmentSetupHelper, string
128128
}
129129

130130
/// <summary>
131-
/// Clears default RM modules list and sets a brand new
131+
/// Clears default RM modules list and sets a brand new
132132
/// </summary>
133133
/// <param name="buildModuleList"></param>
134134
/// <returns></returns>
@@ -152,7 +152,7 @@ public ITestRunnerFactory WithRecordMatcher(RecordMatcherDelegate recordMatcher)
152152
}
153153

154154
/// <summary>
155-
///
155+
///
156156
/// </summary>
157157
/// <param name="userAgentsToIgnore">
158158
/// Dictionary to store pairs: {user agent name, version-api to ignore}.
@@ -247,8 +247,8 @@ protected void SetupAzureContext()
247247
{
248248
var environment = TestEnvironmentFactory.GetTestEnvironment();
249249
tenantId = environment.Tenant;
250-
userDomain = string.IsNullOrEmpty(environment.UserName)
251-
? string.Empty
250+
userDomain = string.IsNullOrEmpty(environment.UserName)
251+
? string.Empty
252252
: environment.UserName.Split(new[] { "@" }, StringSplitOptions.RemoveEmptyEntries).Last();
253253

254254
subscriptionId = environment.SubscriptionId;
@@ -267,7 +267,6 @@ protected void SetupAzureContext()
267267
}
268268

269269
AzureRmProfileProvider.Instance.Profile.DefaultContext.Tenant.Id = tenantId ?? undefined;
270-
AzureRmProfileProvider.Instance.Profile.DefaultContext.Tenant.Directory = userDomain ?? undefined;
271270
AzureRmProfileProvider.Instance.Profile.DefaultContext.Subscription.Id = subscriptionId ?? undefined;
272271
}
273272

0 commit comments

Comments
 (0)