Skip to content

Fix BuildDrop script and update profile cmdlet signatures #1485

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 5 commits into from
Dec 14, 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 @@ -107,7 +107,6 @@ private AuthenticationContext CreateContext(AdalConfiguration config)
private AuthenticationResult AcquireToken(AdalConfiguration config, AuthenticationBehavior behavior, string userId,
string password)
{
AuthenticationResult result = null;
var context = CreateContext(config);

ServiceClientTracing.Information(
Expand Down
3 changes: 2 additions & 1 deletion src/CLU/Commands.ResourceManager.Cmdlets/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@
"System.Threading.Thread": "4.0.0-beta-23516",
"Microsoft.Azure.Management.Resources": "3.3.0-preview",
"Microsoft.Extensions.Caching.Memory": "1.0.0-rc1-final"
}
},
"compilationOptions": {"emitEntryPoint": true}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace Microsoft.Azure.Commands.Profile
/// Cmdlet to log into an environment and download the subscriptions
/// </summary>
[Cmdlet("Add", "AzureRmAccount", DefaultParameterSetName = "User")]
[Alias("Login-AzureRmAccount")]
[Alias("Login-AzureRmAccount", "Login")]
[OutputType(typeof(PSAzureProfile))]
public class AddAzureRMAccountCommand : AzureRMCmdlet
{
Expand All @@ -43,11 +43,10 @@ public class AddAzureRMAccountCommand : AzureRMCmdlet
private const string SubscriptionNameParameterSet = "SubscriptionName";
private const string SubscriptionIdParameterSet = "SubscriptionId";

[Parameter(Mandatory = false, HelpMessage = "Environment containing the account to log into")]
[ValidateNotNullOrEmpty]
public AzureEnvironment Environment { get; set; }

[Parameter(Mandatory = false, HelpMessage = "Name of the environment containing the account to log into")]
[Alias("e")]
[ValidateNotNullOrEmpty]
public string EnvironmentName { get; set; }

Expand All @@ -56,31 +55,37 @@ public class AddAzureRMAccountCommand : AzureRMCmdlet
[Parameter(ParameterSetName = SubscriptionNameParameterSet, Mandatory = false, HelpMessage = "Optional secret")]
public string Secret { get; set; }

[Parameter(ParameterSetName = AccessTokenParameterSet, Mandatory = true, HelpMessage = "Account Id for access token")]
[Parameter(ParameterSetName = UserParameterSet, Mandatory = false, HelpMessage = "User name (in [email protected] format)")]
[Parameter(ParameterSetName = SubscriptionIdParameterSet, Mandatory = false, HelpMessage = "Account Id for access token")]
[Parameter(ParameterSetName = SubscriptionNameParameterSet, Mandatory = false, HelpMessage = "Account Id for access token")]
[ValidateNotNullOrEmpty]
[Alias("u")]
public string Username { get; set; }

[Parameter(ParameterSetName = UserParameterSet, Mandatory = false, HelpMessage = "Optional password")]
[Parameter(ParameterSetName = SubscriptionIdParameterSet, Mandatory = false, HelpMessage = "Account Id for access token")]
[Parameter(ParameterSetName = SubscriptionNameParameterSet, Mandatory = false, HelpMessage = "Account Id for access token")]
[Parameter(ParameterSetName = SubscriptionIdParameterSet, Mandatory = false, HelpMessage = "Optional password")]
[Parameter(ParameterSetName = SubscriptionNameParameterSet, Mandatory = false, HelpMessage = "Optional password")]
[ValidateNotNullOrEmpty]
[Alias("p")]
public string Password { get; set; }

[Parameter(ParameterSetName = ServicePrincipalCertificateParameterSet, Mandatory = true, HelpMessage = "Certificate Hash (Thumbprint)")]
[Parameter(ParameterSetName = SubscriptionIdParameterSet, Mandatory = false, HelpMessage = "Certificate Hash (Thumbprint)")]
[Parameter(ParameterSetName = SubscriptionNameParameterSet, Mandatory = false, HelpMessage = "Certificate Hash (Thumbprint)")]
[Alias("cert")]
public string CertificateThumbprint { get; set; }

[Parameter(ParameterSetName = ServicePrincipalParameterSet, Mandatory = true, HelpMessage = "Credential")]
[Parameter(ParameterSetName = ServicePrincipalCertificateParameterSet, Mandatory = true, HelpMessage = "SPN")]
[Parameter(ParameterSetName = SubscriptionIdParameterSet, Mandatory = false, HelpMessage = "SPN")]
[Parameter(ParameterSetName = SubscriptionNameParameterSet, Mandatory = false, HelpMessage = "SPN")]
[Alias("appid")]
public string ApplicationId { get; set; }

[Parameter(ParameterSetName = ServicePrincipalParameterSet, Mandatory = true)]
[Parameter(ParameterSetName = ServicePrincipalCertificateParameterSet, Mandatory = true)]
[Alias("spn")]
public SwitchParameter ServicePrincipal { get; set; }

[Parameter(ParameterSetName = UserParameterSet, Mandatory = false, HelpMessage = "Optional tenant name or ID")]
Expand All @@ -89,30 +94,27 @@ public class AddAzureRMAccountCommand : AzureRMCmdlet
[Parameter(ParameterSetName = ServicePrincipalCertificateParameterSet, Mandatory = true, HelpMessage = "TenantId name or ID")]
[Parameter(ParameterSetName = SubscriptionIdParameterSet, Mandatory = false, HelpMessage = "TenantId name or ID")]
[Parameter(ParameterSetName = SubscriptionNameParameterSet, Mandatory = false, HelpMessage = "TenantId name or ID")]
[Alias("Domain")]
[Alias("Domain", "t")]
[ValidateNotNullOrEmpty]
public string TenantId { get; set; }

[Parameter(ParameterSetName = AccessTokenParameterSet, Mandatory = true, HelpMessage = "AccessToken")]
[Parameter(ParameterSetName = SubscriptionIdParameterSet, Mandatory = false, HelpMessage = "AccessToken")]
[Parameter(ParameterSetName = SubscriptionNameParameterSet, Mandatory = false, HelpMessage = "AccessToken")]
[ValidateNotNullOrEmpty]
[Alias("token")]
public string AccessToken { get; set; }

[Parameter(ParameterSetName = AccessTokenParameterSet, Mandatory = true, HelpMessage = "Account Id for access token")]
[Parameter(ParameterSetName = SubscriptionIdParameterSet, Mandatory = false, HelpMessage = "Account Id for access token")]
[Parameter(ParameterSetName = SubscriptionNameParameterSet, Mandatory = false, HelpMessage = "Account Id for access token")]
[ValidateNotNullOrEmpty]
public string AccountId { get; set; }

[Parameter(ParameterSetName = SubscriptionIdParameterSet, Mandatory = false, HelpMessage = "Subscription", ValueFromPipelineByPropertyName = true)]
[Parameter(ParameterSetName = ServicePrincipalParameterSet, Mandatory = false, HelpMessage = "Subscription", ValueFromPipelineByPropertyName = true)]
[ValidateNotNullOrEmpty]
[Alias("s", "id")]
public string SubscriptionId { get; set; }

[Parameter(ParameterSetName = SubscriptionNameParameterSet, Mandatory = false, HelpMessage = "Subscription Name", ValueFromPipelineByPropertyName = true)]
[Parameter(ParameterSetName = ServicePrincipalParameterSet, Mandatory = false, HelpMessage = "Subscription Name", ValueFromPipelineByPropertyName = true)]
[ValidateNotNullOrEmpty]
[Alias("n", "name")]
public string SubscriptionName { get; set; }

protected override AzureContext DefaultContext
Expand Down Expand Up @@ -164,13 +166,13 @@ protected override void ProcessRecord()
string password = null;
if (!string.IsNullOrEmpty(AccessToken))
{
if (string.IsNullOrWhiteSpace(AccountId))
if (string.IsNullOrWhiteSpace(Username))
{
throw new PSInvalidOperationException(Resources.AccountIdRequired);
}

azureAccount.Type = AzureAccount.AccountType.AccessToken;
azureAccount.Id = AccountId;
azureAccount.Id = Username;
azureAccount.SetProperty(AzureAccount.Property.AccessToken, AccessToken);
}
else if (ServicePrincipal.IsPresent)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
new: create
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,18 @@ public class SetAzureRMContextCommand : AzureRMCmdlet

[Parameter(ParameterSetName = SubscriptionNameParameterSet, Mandatory = false, HelpMessage = "TenantId name or ID", ValueFromPipelineByPropertyName = true)]
[Parameter(ParameterSetName = SubscriptionIdParameterSet, Mandatory = false, HelpMessage = "TenantId name or ID", ValueFromPipelineByPropertyName = true)]
[Alias("Domain")]
[Alias("Domain", "t")]
[ValidateNotNullOrEmpty]
public string TenantId { get; set; }

[Parameter(ParameterSetName = SubscriptionIdParameterSet, Mandatory = false, HelpMessage = "Subscription", ValueFromPipelineByPropertyName = true)]
[ValidateNotNullOrEmpty]
[Alias("s", "id")]
public string SubscriptionId { get; set; }

[Parameter(ParameterSetName = SubscriptionNameParameterSet, Mandatory = false, HelpMessage = "Subscription Name", ValueFromPipelineByPropertyName = true)]
[ValidateNotNullOrEmpty]
[Alias("n", "name")]
public string SubscriptionName { get; set; }

[Parameter(ParameterSetName = ContextParameterSet, Mandatory = true, HelpMessage = "Context", ValueFromPipeline = true)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
using System.Management.Automation;
using Microsoft.Azure.Commands.Models;
using Microsoft.Azure.Commands.Common.Authentication.Models;
using Microsoft.Azure.Commands.Profile.Models;
using Microsoft.Azure.Commands.ResourceManager.Common;
using Microsoft.Azure.Commands.Common;

namespace Microsoft.Azure.Commands.Profile
{
Expand All @@ -29,28 +27,19 @@ namespace Microsoft.Azure.Commands.Profile
public class AddAzureRMEnvironmentCommand : AzureRMCmdlet
{
[Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true)]
[Alias("n")]
public string Name { get; set; }

[Parameter(Position = 1, Mandatory = false, ValueFromPipelineByPropertyName = true)]
public string PublishSettingsFileUrl { get; set; }

[Parameter(Position = 2, Mandatory = false, ValueFromPipelineByPropertyName = true)]
[Alias("ServiceManagement", "ServiceManagementUrl")]
public string ServiceEndpoint { get; set; }

[Parameter(Position = 3, Mandatory = false, ValueFromPipelineByPropertyName = true)]
public string ManagementPortalUrl { get; set; }

[Parameter(Position = 4, Mandatory = false, HelpMessage = "The storage endpoint")]
[Alias("StorageEndpointSuffix")]
[Alias("StorageEndpointSuffix", "storage")]
public string StorageEndpoint { get; set; }

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

[Parameter(Position = 6, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The cloud service endpoint")]
[Alias("ResourceManager", "ResourceManagerUrl")]
[Alias("ResourceManager", "ResourceManagerUrl", "arm")]
public string ResourceManagerEndpoint { get; set; }

[Parameter(Position = 7, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The public gallery endpoint")]
Expand All @@ -59,40 +48,17 @@ public class AddAzureRMEnvironmentCommand : AzureRMCmdlet

[Parameter(Position = 8, Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "Identifier of the target resource that is the recipient of the requested token.")]
[Alias("audience","aud")]
public string ActiveDirectoryServiceEndpointResourceId { get; set; }

[Parameter(Position = 9, Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "The AD Graph Endpoint.")]
[Alias("Graph", "GraphUrl")]
public string GraphEndpoint { get; set; }

[Parameter(Position = 10, Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "Dns suffix of Azure Key Vault service. Example is vault-int.azure-int.net")]
public string AzureKeyVaultDnsSuffix { get; set; }

[Parameter(Position = 11, Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "Resource identifier of Azure Key Vault data service that is the recipient of the requested token.")]
public string AzureKeyVaultServiceEndpointResourceId { get; set; }

[Parameter(Position = 12, Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "Dns suffix of Traffic Manager service.")]
public string TrafficManagerDnsSuffix { get; set; }

[Parameter(Position = 13, Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "Dns suffix of Sql databases created in this environment.")]
public string SqlDatabaseDnsSuffix { get; set; }

[Parameter(Position = 14, Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "Dns Suffix of Azure Data Lake Store FileSystem. Example: azuredatalake.net")]
public string AzureDataLakeStoreFileSystemEndpointSuffix { get; set; }

[Parameter(Position = 15, Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "Dns Suffix of Azure Data Lake Analytics job and catalog services")]
public string AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix { get; set; }

[Parameter(Position = 16, Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "Enable ADFS authentication by disabling the authority validation")]
[Alias("OnPremise")]
[Alias("OnPremise", "adfs")]
public SwitchParameter EnableAdfsAuthentication { get; set; }

[Parameter(Position = 17, Mandatory = false, ValueFromPipelineByPropertyName = true,
Expand All @@ -114,21 +80,12 @@ protected override void ProcessRecord()
OnPremise = EnableAdfsAuthentication
};

newEnvironment.Endpoints[AzureEnvironment.Endpoint.PublishSettingsFileUrl] = PublishSettingsFileUrl;
newEnvironment.Endpoints[AzureEnvironment.Endpoint.ServiceManagement] = ServiceEndpoint;
newEnvironment.Endpoints[AzureEnvironment.Endpoint.ResourceManager] = ResourceManagerEndpoint;
newEnvironment.Endpoints[AzureEnvironment.Endpoint.ManagementPortalUrl] = ManagementPortalUrl;
newEnvironment.Endpoints[AzureEnvironment.Endpoint.StorageEndpointSuffix] = StorageEndpoint;
newEnvironment.Endpoints[AzureEnvironment.Endpoint.ActiveDirectory] = ActiveDirectoryEndpoint;
newEnvironment.Endpoints[AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId] = ActiveDirectoryServiceEndpointResourceId;
newEnvironment.Endpoints[AzureEnvironment.Endpoint.Gallery] = GalleryEndpoint;
newEnvironment.Endpoints[AzureEnvironment.Endpoint.Graph] = GraphEndpoint;
newEnvironment.Endpoints[AzureEnvironment.Endpoint.AzureKeyVaultDnsSuffix] = AzureKeyVaultDnsSuffix;
newEnvironment.Endpoints[AzureEnvironment.Endpoint.AzureKeyVaultServiceEndpointResourceId] = AzureKeyVaultServiceEndpointResourceId;
newEnvironment.Endpoints[AzureEnvironment.Endpoint.TrafficManagerDnsSuffix] = TrafficManagerDnsSuffix;
newEnvironment.Endpoints[AzureEnvironment.Endpoint.SqlDatabaseDnsSuffix] = SqlDatabaseDnsSuffix;
newEnvironment.Endpoints[AzureEnvironment.Endpoint.AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix] = AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix;
newEnvironment.Endpoints[AzureEnvironment.Endpoint.AzureDataLakeStoreFileSystemEndpointSuffix] = AzureDataLakeStoreFileSystemEndpointSuffix;
newEnvironment.Endpoints[AzureEnvironment.Endpoint.AdTenant] = AdTenant;
WriteObject((PSAzureEnvironment)profileClient.AddOrSetEnvironment(newEnvironment));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ namespace Microsoft.Azure.Commands.Profile
public class GetAzureRMEnvironmentCommand : AzureRMCmdlet
{
[Parameter(Position = 0, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The environment name")]
[Alias("n")]
public string Name { get; set; }

protected override void BeginProcessing()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ public class RemoveAzureRMEnvironmentCommand : AzureRMCmdlet
{
[Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true,
HelpMessage = "The environment name")]
[Alias("n")]
public string Name { get; set; }

[Parameter(Position = 1, HelpMessage = "Do not confirm deletion of subscription")]
[Alias("f")]
public SwitchParameter Force { get; set; }

protected override void BeginProcessing()
Expand Down
Loading