Skip to content

Commit 8ebd9b5

Browse files
committed
Merge pull request Azure#244 from Azure/clu
Clu
2 parents 2f5f42c + 0e736d4 commit 8ebd9b5

File tree

25 files changed

+95
-176
lines changed

25 files changed

+95
-176
lines changed

src/CLU/Commands.Common.Authentication/Authentication/UserTokenProvider.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ private AuthenticationContext CreateContext(AdalConfiguration config)
107107
private AuthenticationResult AcquireToken(AdalConfiguration config, AuthenticationBehavior behavior, string userId,
108108
string password)
109109
{
110-
AuthenticationResult result = null;
111110
var context = CreateContext(config);
112111

113112
ServiceClientTracing.Information(

src/CLU/Commands.Common.Authentication/project.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
"dependencies": {
1818
"System.Linq": "4.0.1-beta-23516",
1919
"Microsoft.CLU": "1.0.0",
20-
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.6.210231457-alpha",
21-
"Microsoft.Rest.ClientRuntime": "1.5.0",
22-
"Microsoft.Rest.ClientRuntime.Azure.Authentication": "1.0.0-preview",
20+
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.6.212041202-alpha",
21+
"Microsoft.Rest.ClientRuntime": "1.8.0",
22+
"Microsoft.Rest.ClientRuntime.Azure.Authentication": "1.2.1-preview",
2323
"Newtonsoft.Json": "7.0.1",
2424
"System.Collections": "4.0.11-beta-23516",
2525
"System.Collections.Concurrent": "4.0.11-beta-23516",

src/CLU/Commands.ResourceManager.Cmdlets/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,6 @@
4848
"System.Threading.Thread": "4.0.0-beta-23516",
4949
"Microsoft.Azure.Management.Resources": "3.3.0-preview",
5050
"Microsoft.Extensions.Caching.Memory": "1.0.0-rc1-final"
51-
}
51+
},
52+
"compilationOptions": {"emitEntryPoint": true}
5253
}

src/CLU/Commands.ScenarioTests.ResourceManager.Common/project.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
"Commands.Common.Authentication": "",
2222
"Commands.ResourceManager.Common": "",
2323
"Microsoft.Azure.Management.Resources": "3.3.0-preview",
24-
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.6.210231457-alpha",
25-
"Microsoft.Rest.ClientRuntime": "1.5.0",
26-
"Microsoft.Rest.ClientRuntime.Azure": "2.1.0",
27-
"Microsoft.Rest.ClientRuntime.Azure.Authentication": "1.0.0-preview",
24+
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.6.212041202-alpha",
25+
"Microsoft.Rest.ClientRuntime": "1.8.0",
26+
"Microsoft.Rest.ClientRuntime.Azure": "2.5.1",
27+
"Microsoft.Rest.ClientRuntime.Azure.Authentication": "1.2.1-preview",
2828
"Newtonsoft.Json": "7.0.1",
2929
"System.Collections": "4.0.11-beta-23516",
3030
"System.Collections.Concurrent": "4.0.11-beta-23516",

src/CLU/Microsoft.Azure.Commands.Profile.Test/project.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
"Commands.ScenarioTests.ResourceManager.Common": "",
2424
"Microsoft.Azure.Commands.Profile": "",
2525
"Microsoft.Azure.Management.Resources": "3.3.0-preview",
26-
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.6.210231457-alpha",
27-
"Microsoft.Rest.ClientRuntime": "1.5.0",
28-
"Microsoft.Rest.ClientRuntime.Azure": "2.1.0",
29-
"Microsoft.Rest.ClientRuntime.Azure.Authentication": "1.0.0-preview",
26+
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.6.212041202-alpha",
27+
"Microsoft.Rest.ClientRuntime": "1.8.0",
28+
"Microsoft.Rest.ClientRuntime.Azure": "2.5.1",
29+
"Microsoft.Rest.ClientRuntime.Azure.Authentication": "1.2.1-preview",
3030
"Newtonsoft.Json": "7.0.1",
3131
"System.Collections": "4.0.11-beta-23516",
3232
"System.Collections.Concurrent": "4.0.11-beta-23516",

src/CLU/Microsoft.Azure.Commands.Profile/Account/AddAzureRmAccount.cs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace Microsoft.Azure.Commands.Profile
3232
/// Cmdlet to log into an environment and download the subscriptions
3333
/// </summary>
3434
[Cmdlet("Add", "AzureRmAccount", DefaultParameterSetName = "User")]
35-
[Alias("Login-AzureRmAccount")]
35+
[Alias("Login-AzureRmAccount", "Login")]
3636
[OutputType(typeof(PSAzureProfile))]
3737
public class AddAzureRMAccountCommand : AzureRMCmdlet
3838
{
@@ -43,11 +43,10 @@ public class AddAzureRMAccountCommand : AzureRMCmdlet
4343
private const string SubscriptionNameParameterSet = "SubscriptionName";
4444
private const string SubscriptionIdParameterSet = "SubscriptionId";
4545

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

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

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

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

6566
[Parameter(ParameterSetName = UserParameterSet, Mandatory = false, HelpMessage = "Optional password")]
66-
[Parameter(ParameterSetName = SubscriptionIdParameterSet, Mandatory = false, HelpMessage = "Account Id for access token")]
67-
[Parameter(ParameterSetName = SubscriptionNameParameterSet, Mandatory = false, HelpMessage = "Account Id for access token")]
67+
[Parameter(ParameterSetName = SubscriptionIdParameterSet, Mandatory = false, HelpMessage = "Optional password")]
68+
[Parameter(ParameterSetName = SubscriptionNameParameterSet, Mandatory = false, HelpMessage = "Optional password")]
6869
[ValidateNotNullOrEmpty]
70+
[Alias("p")]
6971
public string Password { get; set; }
7072

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

7679
[Parameter(ParameterSetName = ServicePrincipalParameterSet, Mandatory = true, HelpMessage = "Credential")]
7780
[Parameter(ParameterSetName = ServicePrincipalCertificateParameterSet, Mandatory = true, HelpMessage = "SPN")]
7881
[Parameter(ParameterSetName = SubscriptionIdParameterSet, Mandatory = false, HelpMessage = "SPN")]
7982
[Parameter(ParameterSetName = SubscriptionNameParameterSet, Mandatory = false, HelpMessage = "SPN")]
83+
[Alias("appid")]
8084
public string ApplicationId { get; set; }
8185

8286
[Parameter(ParameterSetName = ServicePrincipalParameterSet, Mandatory = true)]
8387
[Parameter(ParameterSetName = ServicePrincipalCertificateParameterSet, Mandatory = true)]
88+
[Alias("spn")]
8489
public SwitchParameter ServicePrincipal { get; set; }
8590

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

96101
[Parameter(ParameterSetName = AccessTokenParameterSet, Mandatory = true, HelpMessage = "AccessToken")]
97102
[Parameter(ParameterSetName = SubscriptionIdParameterSet, Mandatory = false, HelpMessage = "AccessToken")]
98103
[Parameter(ParameterSetName = SubscriptionNameParameterSet, Mandatory = false, HelpMessage = "AccessToken")]
99104
[ValidateNotNullOrEmpty]
105+
[Alias("token")]
100106
public string AccessToken { get; set; }
101107

102-
[Parameter(ParameterSetName = AccessTokenParameterSet, Mandatory = true, HelpMessage = "Account Id for access token")]
103-
[Parameter(ParameterSetName = SubscriptionIdParameterSet, Mandatory = false, HelpMessage = "Account Id for access token")]
104-
[Parameter(ParameterSetName = SubscriptionNameParameterSet, Mandatory = false, HelpMessage = "Account Id for access token")]
105-
[ValidateNotNullOrEmpty]
106-
public string AccountId { get; set; }
107-
108108
[Parameter(ParameterSetName = SubscriptionIdParameterSet, Mandatory = false, HelpMessage = "Subscription", ValueFromPipelineByPropertyName = true)]
109109
[Parameter(ParameterSetName = ServicePrincipalParameterSet, Mandatory = false, HelpMessage = "Subscription", ValueFromPipelineByPropertyName = true)]
110110
[ValidateNotNullOrEmpty]
111+
[Alias("s", "id")]
111112
public string SubscriptionId { get; set; }
112113

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

118120
protected override AzureContext DefaultContext
@@ -164,13 +166,13 @@ protected override void ProcessRecord()
164166
string password = null;
165167
if (!string.IsNullOrEmpty(AccessToken))
166168
{
167-
if (string.IsNullOrWhiteSpace(AccountId))
169+
if (string.IsNullOrWhiteSpace(Username))
168170
{
169171
throw new PSInvalidOperationException(Resources.AccountIdRequired);
170172
}
171173

172174
azureAccount.Type = AzureAccount.AccountType.AccessToken;
173-
azureAccount.Id = AccountId;
175+
azureAccount.Id = Username;
174176
azureAccount.SetProperty(AzureAccount.Property.AccessToken, AccessToken);
175177
}
176178
else if (ServicePrincipal.IsPresent)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
new: create

src/CLU/Microsoft.Azure.Commands.Profile/Context/SetAzureRMContext.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,18 @@ public class SetAzureRMContextCommand : AzureRMCmdlet
3838

3939
[Parameter(ParameterSetName = SubscriptionNameParameterSet, Mandatory = false, HelpMessage = "TenantId name or ID", ValueFromPipelineByPropertyName = true)]
4040
[Parameter(ParameterSetName = SubscriptionIdParameterSet, Mandatory = false, HelpMessage = "TenantId name or ID", ValueFromPipelineByPropertyName = true)]
41-
[Alias("Domain")]
41+
[Alias("Domain", "t")]
4242
[ValidateNotNullOrEmpty]
4343
public string TenantId { get; set; }
4444

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

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

5355
[Parameter(ParameterSetName = ContextParameterSet, Mandatory = true, HelpMessage = "Context", ValueFromPipeline = true)]

src/CLU/Microsoft.Azure.Commands.Profile/Environment/AddAzureRMEnvironment.cs

Lines changed: 6 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
using System.Management.Automation;
1616
using Microsoft.Azure.Commands.Models;
1717
using Microsoft.Azure.Commands.Common.Authentication.Models;
18-
using Microsoft.Azure.Commands.Profile.Models;
1918
using Microsoft.Azure.Commands.ResourceManager.Common;
20-
using Microsoft.Azure.Commands.Common;
2119

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

34-
[Parameter(Position = 1, Mandatory = false, ValueFromPipelineByPropertyName = true)]
35-
public string PublishSettingsFileUrl { get; set; }
36-
37-
[Parameter(Position = 2, Mandatory = false, ValueFromPipelineByPropertyName = true)]
38-
[Alias("ServiceManagement", "ServiceManagementUrl")]
39-
public string ServiceEndpoint { get; set; }
40-
41-
[Parameter(Position = 3, Mandatory = false, ValueFromPipelineByPropertyName = true)]
42-
public string ManagementPortalUrl { get; set; }
43-
4433
[Parameter(Position = 4, Mandatory = false, HelpMessage = "The storage endpoint")]
45-
[Alias("StorageEndpointSuffix")]
34+
[Alias("StorageEndpointSuffix", "storage")]
4635
public string StorageEndpoint { get; set; }
4736

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

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

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

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

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

69-
[Parameter(Position = 10, Mandatory = false, ValueFromPipelineByPropertyName = true,
70-
HelpMessage = "Dns suffix of Azure Key Vault service. Example is vault-int.azure-int.net")]
71-
public string AzureKeyVaultDnsSuffix { get; set; }
72-
73-
[Parameter(Position = 11, Mandatory = false, ValueFromPipelineByPropertyName = true,
74-
HelpMessage = "Resource identifier of Azure Key Vault data service that is the recipient of the requested token.")]
75-
public string AzureKeyVaultServiceEndpointResourceId { get; set; }
76-
77-
[Parameter(Position = 12, Mandatory = false, ValueFromPipelineByPropertyName = true,
78-
HelpMessage = "Dns suffix of Traffic Manager service.")]
79-
public string TrafficManagerDnsSuffix { get; set; }
80-
81-
[Parameter(Position = 13, Mandatory = false, ValueFromPipelineByPropertyName = true,
82-
HelpMessage = "Dns suffix of Sql databases created in this environment.")]
83-
public string SqlDatabaseDnsSuffix { get; set; }
84-
85-
[Parameter(Position = 14, Mandatory = false, ValueFromPipelineByPropertyName = true,
86-
HelpMessage = "Dns Suffix of Azure Data Lake Store FileSystem. Example: azuredatalake.net")]
87-
public string AzureDataLakeStoreFileSystemEndpointSuffix { get; set; }
88-
89-
[Parameter(Position = 15, Mandatory = false, ValueFromPipelineByPropertyName = true,
90-
HelpMessage = "Dns Suffix of Azure Data Lake Analytics job and catalog services")]
91-
public string AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix { get; set; }
92-
9359
[Parameter(Position = 16, Mandatory = false, ValueFromPipelineByPropertyName = true,
9460
HelpMessage = "Enable ADFS authentication by disabling the authority validation")]
95-
[Alias("OnPremise")]
61+
[Alias("OnPremise", "adfs")]
9662
public SwitchParameter EnableAdfsAuthentication { get; set; }
9763

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

117-
newEnvironment.Endpoints[AzureEnvironment.Endpoint.PublishSettingsFileUrl] = PublishSettingsFileUrl;
118-
newEnvironment.Endpoints[AzureEnvironment.Endpoint.ServiceManagement] = ServiceEndpoint;
11983
newEnvironment.Endpoints[AzureEnvironment.Endpoint.ResourceManager] = ResourceManagerEndpoint;
120-
newEnvironment.Endpoints[AzureEnvironment.Endpoint.ManagementPortalUrl] = ManagementPortalUrl;
12184
newEnvironment.Endpoints[AzureEnvironment.Endpoint.StorageEndpointSuffix] = StorageEndpoint;
12285
newEnvironment.Endpoints[AzureEnvironment.Endpoint.ActiveDirectory] = ActiveDirectoryEndpoint;
12386
newEnvironment.Endpoints[AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId] = ActiveDirectoryServiceEndpointResourceId;
12487
newEnvironment.Endpoints[AzureEnvironment.Endpoint.Gallery] = GalleryEndpoint;
12588
newEnvironment.Endpoints[AzureEnvironment.Endpoint.Graph] = GraphEndpoint;
126-
newEnvironment.Endpoints[AzureEnvironment.Endpoint.AzureKeyVaultDnsSuffix] = AzureKeyVaultDnsSuffix;
127-
newEnvironment.Endpoints[AzureEnvironment.Endpoint.AzureKeyVaultServiceEndpointResourceId] = AzureKeyVaultServiceEndpointResourceId;
128-
newEnvironment.Endpoints[AzureEnvironment.Endpoint.TrafficManagerDnsSuffix] = TrafficManagerDnsSuffix;
129-
newEnvironment.Endpoints[AzureEnvironment.Endpoint.SqlDatabaseDnsSuffix] = SqlDatabaseDnsSuffix;
130-
newEnvironment.Endpoints[AzureEnvironment.Endpoint.AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix] = AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix;
131-
newEnvironment.Endpoints[AzureEnvironment.Endpoint.AzureDataLakeStoreFileSystemEndpointSuffix] = AzureDataLakeStoreFileSystemEndpointSuffix;
13289
newEnvironment.Endpoints[AzureEnvironment.Endpoint.AdTenant] = AdTenant;
13390
WriteObject((PSAzureEnvironment)profileClient.AddOrSetEnvironment(newEnvironment));
13491
}

src/CLU/Microsoft.Azure.Commands.Profile/Environment/GetAzureRMEnvironment.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ namespace Microsoft.Azure.Commands.Profile
3030
public class GetAzureRMEnvironmentCommand : AzureRMCmdlet
3131
{
3232
[Parameter(Position = 0, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The environment name")]
33+
[Alias("n")]
3334
public string Name { get; set; }
3435

3536
protected override void BeginProcessing()

src/CLU/Microsoft.Azure.Commands.Profile/Environment/RemoveAzureRMEnvironment.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ public class RemoveAzureRMEnvironmentCommand : AzureRMCmdlet
2929
{
3030
[Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true,
3131
HelpMessage = "The environment name")]
32+
[Alias("n")]
3233
public string Name { get; set; }
3334

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

3739
protected override void BeginProcessing()

0 commit comments

Comments
 (0)