Skip to content

Commit

Permalink
Merge pull request #2031 from ogail/env
Browse files Browse the repository at this point in the history
Fixes for Add-AzureEnvironment
  • Loading branch information
Abdelrahman Elogeel authored and Abdelrahman Elogeel committed Oct 17, 2013
2 parents 765872a + 43d3d1b commit 870af45
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 17 deletions.
Expand Up @@ -142,8 +142,8 @@ public void SavingWritesProfileDataToStore()
Name = sourceEnv.Name,
PublishSettingsFileUrl = sourceEnv.PublishSettingsFileUrl,
ServiceEndpoint = sourceEnv.ServiceEndpoint,
AdTenantUrl = sourceEnv.AdTenantUrl,
CommonTenantId = sourceEnv.CommonTenantId,
ActiveDirectoryEndpoint = sourceEnv.AdTenantUrl,
ActiveDirectoryCommonTenantId = sourceEnv.CommonTenantId,
StorageEndpointSuffix = sourceEnv.StorageEndpointSuffix
});

Expand Down
Expand Up @@ -76,8 +76,8 @@ public AdalConfiguration()
public AdalConfiguration(WindowsAzureEnvironment environment)
: this()
{
AdEndpoint = environment.AdTenantUrl;
AdDomain = environment.CommonTenantId;
AdEndpoint = environment.ActiveDirectoryEndpoint;
AdDomain = environment.ActiveDirectoryCommonTenantId;
}

public AdalConfiguration(WindowsAzureSubscription subscription)
Expand Down
Expand Up @@ -66,8 +66,8 @@ public AzureEnvironmentData(WindowsAzureEnvironment inMemoryEnvironment)
ServiceEndpoint = inMemoryEnvironment.ServiceEndpoint;
ManagementPortalUrl = inMemoryEnvironment.ManagementPortalUrl;
StorageEndpointSuffix = inMemoryEnvironment.StorageEndpointSuffix;
AdTenantUrl = inMemoryEnvironment.AdTenantUrl;
CommonTenantId = inMemoryEnvironment.CommonTenantId;
AdTenantUrl = inMemoryEnvironment.ActiveDirectoryEndpoint;
CommonTenantId = inMemoryEnvironment.ActiveDirectoryCommonTenantId;
}

/// <summary>
Expand All @@ -82,8 +82,8 @@ public WindowsAzureEnvironment ToAzureEnvironment()
ServiceEndpoint = this.ServiceEndpoint,
ManagementPortalUrl = this.ManagementPortalUrl,
StorageEndpointSuffix = this.StorageEndpointSuffix,
AdTenantUrl = this.AdTenantUrl,
CommonTenantId = this.CommonTenantId
ActiveDirectoryEndpoint = this.AdTenantUrl,
ActiveDirectoryCommonTenantId = this.CommonTenantId
};
}

Expand Down
Expand Up @@ -47,14 +47,14 @@ public class WindowsAzureEnvironment
/// Url for the Active Directory tenant for this environment
/// </summary>
/// <remarks>If null, this environment does not support AD authentication</remarks>
public string AdTenantUrl { get; set; }
public string ActiveDirectoryEndpoint { get; set; }

/// <summary>
/// Name for the common tenant used as the first step
/// in the AD authentication process for this environment.
/// </summary>
/// <remarks>If null, this environment does not support AD authentication</remarks>
public string CommonTenantId { get; set; }
public string ActiveDirectoryCommonTenantId { get; set; }

private string storageEndpointSuffix;

Expand Down Expand Up @@ -169,7 +169,7 @@ private string AddRealm(string baseUrl, string realm)

public IEnumerable<WindowsAzureSubscription> AddAccount(ITokenProvider tokenProvider)
{
if (AdTenantUrl == null)
if (ActiveDirectoryEndpoint == null)
{
throw new Exception(string.Format(Resources.EnvironmentDoesNotSupportActiveDirectory, Name));
}
Expand All @@ -185,7 +185,7 @@ public IEnumerable<WindowsAzureSubscription> AddAccount(ITokenProvider tokenProv
{
var azureSubscription = new WindowsAzureSubscription
{
ActiveDirectoryEndpoint = AdTenantUrl,
ActiveDirectoryEndpoint = ActiveDirectoryEndpoint,
ActiveDirectoryTenantId = subscription.ActiveDirectoryTenantId,
ActiveDirectoryUserId = mainToken.UserId,
SubscriptionId = subscription.SubscriptionId,
Expand Down Expand Up @@ -227,8 +227,8 @@ public IEnumerable<WindowsAzureSubscription> AddAccount(ITokenProvider tokenProv
ServiceEndpoint = WindowsAzureEnvironmentConstants.AzureServiceEndpoint,
ManagementPortalUrl = WindowsAzureEnvironmentConstants.AzureManagementPortalUrl,
// TODO: Get real endpoint for prod
AdTenantUrl = "https://login.windows.net/",
CommonTenantId = "common",
ActiveDirectoryEndpoint = "https://login.windows.net/",
ActiveDirectoryCommonTenantId = "common",
StorageEndpointSuffix = WindowsAzureEnvironmentConstants.AzureStorageEndpointSuffix
}
},
Expand Down
Expand Up @@ -607,6 +607,13 @@
</maml:description>
<command:parameterValue required="true" variableLength = "false" >String</command:parameterValue>
</command:parameter>
<command:parameter required = "false" variableLength = "false" globbing = "false" pipelineInput = "true (ByPropertyName)" position = "named" >
<maml:name>ActiveDirectoryEndpoint</maml:name>
<maml:description>
<maml:para>The URI for the Active Directory service for this environment</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength = "false" >String</command:parameterValue>
</command:parameter>
</command:syntaxItem>
</command:syntax>
<command:parameters>
Expand Down Expand Up @@ -645,6 +652,13 @@
</maml:description>
<command:parameterValue required="true" variableLength = "false" >String</command:parameterValue>
</command:parameter>
<command:parameter required = "false" variableLength = "false" globbing = "false" pipelineInput = "true (ByPropertyName)" position = "named" >
<maml:name>ActiveDirectoryEndpoint</maml:name>
<maml:description>
<maml:para>The URI for the Active Directory service for this environment</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength = "false" >String</command:parameterValue>
</command:parameter>
</command:parameters>
<command:inputTypes>
<command:inputType>
Expand Down
Expand Up @@ -41,7 +41,7 @@ public class AddAzureEnvironmentCommand : CmdletBase
public string StorageEndpoint { get; set; }

[Parameter(Position = 5, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The URI for the Active Directory service for this environment")]
public string AdTenantUrl { get; set; }
public string ActiveDirectoryEndpoint { get; set; }

[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
public override void ExecuteCmdlet()
Expand All @@ -53,7 +53,8 @@ public override void ExecuteCmdlet()
ServiceEndpoint = ServiceEndpoint,
ManagementPortalUrl = ManagementPortalUrl,
StorageEndpointSuffix = StorageEndpoint,
AdTenantUrl = AdTenantUrl
ActiveDirectoryEndpoint = ActiveDirectoryEndpoint,
ActiveDirectoryCommonTenantId = "Common"
};

WindowsAzureProfile.Instance.AddEnvironment(newEnvironment);
Expand Down
Expand Up @@ -53,7 +53,7 @@ public override void ExecuteCmdlet()
env.ServiceEndpoint = Value(ServiceEndpoint, env.ServiceEndpoint);
env.ManagementPortalUrl = Value(ManagementPortalUrl, env.ManagementPortalUrl);
env.StorageEndpointSuffix = Value(StorageEndpoint, env.StorageEndpointSuffix);
env.AdTenantUrl = Value(AdEndpointUrl, env.AdTenantUrl);
env.ActiveDirectoryEndpoint = Value(AdEndpointUrl, env.ActiveDirectoryEndpoint);

WindowsAzureProfile.Instance.UpdateEnvironment(env);

Expand Down

0 comments on commit 870af45

Please sign in to comment.