Skip to content

Commit b8833e2

Browse files
authored
Merge pull request #97 from Azure/tenant-domain-name
Remove Directory property from Tenant
2 parents dbaf847 + 41194c3 commit b8833e2

File tree

6 files changed

+5
-31
lines changed

6 files changed

+5
-31
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: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public class TestManager : ITestRunnerFactory, ITestRunner
5656
/// <returns></returns>
5757
public static ITestRunnerFactory CreateInstance(ITestOutputHelper output, [CallerFilePath] string callerFilePath = null)
5858
{
59-
var callingClassName = string.IsNullOrEmpty(callerFilePath)
59+
var callingClassName = string.IsNullOrEmpty(callerFilePath)
6060
? null
6161
: Path.GetFileNameWithoutExtension(callerFilePath);
6262
return new TestManager(callingClassName).WithTestOutputHelper(output);
@@ -84,7 +84,7 @@ protected TestManager(string callingClassName)
8484
#region Builder impl
8585

8686
/// <summary>
87-
/// Sets a name of the subfolder where a test project keeps tests
87+
/// Sets a name of the subfolder where a test project keeps tests
8888
/// </summary>
8989
/// <param name="folderName"></param>
9090
/// <returns>self</returns>
@@ -130,7 +130,7 @@ public ITestRunnerFactory WithExtraRmModules(Func<EnvironmentSetupHelper, string
130130
}
131131

132132
/// <summary>
133-
/// Clears default RM modules list and sets a brand new
133+
/// Clears default RM modules list and sets a brand new
134134
/// </summary>
135135
/// <param name="buildModuleList"></param>
136136
/// <returns></returns>
@@ -167,7 +167,7 @@ public ITestRunnerFactory WithRecordMatcher(RecordMatcherDelegate recordMatcher)
167167
}
168168

169169
/// <summary>
170-
///
170+
///
171171
/// </summary>
172172
/// <param name="userAgentsToIgnore">
173173
/// Dictionary to store pairs: {user agent name, version-api to ignore}.
@@ -265,7 +265,6 @@ protected void SetupAzureContext()
265265
string tenantId = null;
266266
string userDomain = null;
267267
string subscriptionId = null;
268-
269268
switch (HttpMockServer.Mode)
270269
{
271270
case HttpRecorderMode.Record:
@@ -295,7 +294,6 @@ protected void SetupAzureContext()
295294
}
296295

297296
AzureRmProfileProvider.Instance.Profile.DefaultContext.Tenant.Id = tenantId ?? undefined;
298-
AzureRmProfileProvider.Instance.Profile.DefaultContext.Tenant.Directory = userDomain ?? undefined;
299297
AzureRmProfileProvider.Instance.Profile.DefaultContext.Subscription.Id = subscriptionId ?? undefined;
300298
}
301299

0 commit comments

Comments
 (0)