Skip to content

File tree

11 files changed

+27
-32
lines changed

11 files changed

+27
-32
lines changed

src/Accounts/Accounts/Account/ConnectAzureRmAccount.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ namespace Microsoft.Azure.Commands.Profile
4747
/// <summary>
4848
/// Cmdlet to log into an environment and download the subscriptions
4949
/// </summary>
50-
[Cmdlet("Connect", AzureRMConstants.AzureRMPrefix + "Account", DefaultParameterSetName = "UserWithSubscriptionId", SupportsShouldProcess=true)]
50+
[Cmdlet("Connect", AzureRMConstants.AzureRMPrefix + "Account", DefaultParameterSetName = UserParameterSet, SupportsShouldProcess=true)]
5151
[Alias("Login-AzAccount", "Login-AzureRmAccount", "Add-" + AzureRMConstants.AzureRMPrefix + "Account")]
5252
[OutputType(typeof(PSAzureProfile))]
5353
public class ConnectAzureRmAccountCommand : AzureContextModificationCmdlet, IModuleAssemblyInitializer
@@ -137,6 +137,8 @@ public class ConnectAzureRmAccountCommand : AzureContextModificationCmdlet, IMod
137137
[ValidateNotNullOrEmpty]
138138
public string KeyVaultAccessToken { get; set; }
139139

140+
[Parameter(ParameterSetName = UserParameterSet,
141+
Mandatory = false, HelpMessage = "Account Id / User Id / User Name to login with")]
140142
[Parameter(ParameterSetName = AccessTokenParameterSet,
141143
Mandatory = true, HelpMessage = "Account Id for access token")]
142144
[Parameter(ParameterSetName = ManagedServiceParameterSet,
@@ -323,6 +325,13 @@ public override void ExecuteCmdlet()
323325

324326
switch (ParameterSetName)
325327
{
328+
case UserParameterSet:
329+
azureAccount.Type = AzureAccount.AccountType.User;
330+
if(!string.IsNullOrEmpty(AccountId))
331+
{
332+
azureAccount.SetProperty("LoginHint", AccountId);
333+
}
334+
break;
326335
case AccessTokenParameterSet:
327336
azureAccount.Type = AzureAccount.AccountType.AccessToken;
328337
azureAccount.Id = AccountId;

src/Accounts/Accounts/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
-->
2020

2121
## Upcoming Release
22+
* Supported login hint
2223
* Added Environment auto completer to the following cmdlets: Connect-AzAccount, Get-AzEnvironment, Set-AzEnvironment, and Remove-AzEnvironment [#15991]
2324

2425
## Version 2.6.1

src/Accounts/Accounts/help/Connect-AzAccount.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ Connect to Azure with an authenticated account for use with cmdlets from the Az
1414

1515
### UserWithSubscriptionId (Default)
1616
```
17-
Connect-AzAccount [-Environment <String>] [-Tenant <String>] [-Subscription <String>] [-AuthScope <String>]
18-
[-ContextName <String>] [-SkipContextPopulation] [-MaxContextPopulation <Int32>] [-UseDeviceAuthentication]
19-
[-Force] [-Scope <ContextModificationScope>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
20-
[<CommonParameters>]
17+
Connect-AzAccount [-Environment <String>] [-Tenant <String>] [-AccountId <String>] [-Subscription <String>]
18+
[-AuthScope <String>] [-ContextName <String>] [-SkipContextPopulation] [-MaxContextPopulation <Int32>]
19+
[-UseDeviceAuthentication] [-Force] [-Scope <ContextModificationScope>]
20+
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
2121
```
2222

2323
### ServicePrincipalWithSubscriptionId
@@ -275,16 +275,16 @@ Accept wildcard characters: False
275275
276276
### -AccountId
277277
278-
Account ID for access token in **AccessToken** parameter set. Account ID for managed service in
278+
Account Id / User Id / User Name to login with in **Default (UserWithSubscriptionId)** parameter set; Account ID for access token in **AccessToken** parameter set; Account ID for managed service in
279279
**ManagedService** parameter set. Can be a managed service resource ID, or the associated client ID.
280280
To use the system assigned identity, leave this field blank.
281281
282282
```yaml
283283
Type: System.String
284-
Parameter Sets: AccessTokenWithSubscriptionId
284+
Parameter Sets: UserWithSubscriptionId, ManagedServiceLogin
285285
Aliases:
286286

287-
Required: True
287+
Required: False
288288
Position: Named
289289
Default value: None
290290
Accept pipeline input: False
@@ -293,10 +293,10 @@ Accept wildcard characters: False
293293
294294
```yaml
295295
Type: System.String
296-
Parameter Sets: ManagedServiceLogin
296+
Parameter Sets: AccessTokenWithSubscriptionId
297297
Aliases:
298298

299-
Required: False
299+
Required: True
300300
Position: Named
301301
Default value: None
302302
Accept pipeline input: False

src/Accounts/Accounts/help/Open-AzSurveyLink.md

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Open survey link in default browser.
1313
## SYNTAX
1414

1515
```
16-
Open-AzSurveyLink [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
16+
Open-AzSurveyLink [<CommonParameters>]
1717
```
1818

1919
## DESCRIPTION
@@ -29,21 +29,6 @@ Opening the default browser to https://aka.ms/azpssurvey?Q_CHL=INTERCEPT
2929

3030
## PARAMETERS
3131

32-
### -DefaultProfile
33-
The credentials, account, tenant, and subscription used for communication with Azure.
34-
35-
```yaml
36-
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
37-
Parameter Sets: (All)
38-
Aliases: AzContext, AzureRmContext, AzureCredential
39-
40-
Required: False
41-
Position: Named
42-
Default value: None
43-
Accept pipeline input: False
44-
Accept wildcard characters: False
45-
```
46-
4732
### CommonParameters
4833
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
4934

src/Accounts/Authentication/Authentication.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Azure.Identity" Version="1.4.0" />
15+
<PackageReference Include="Azure.Identity" Version="1.5.0" />
1616
</ItemGroup>
1717

1818
<ItemGroup>
@@ -30,4 +30,4 @@
3030
</EmbeddedResource>
3131
</ItemGroup>
3232

33-
</Project>
33+
</Project>

src/Accounts/Authentication/Factories/AuthenticationFactory.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,8 +545,7 @@ private AuthenticationParameters GetAuthenticationParameters(
545545
{
546546
return new UsernamePasswordParameters(tokenCacheProvider, environment, tokenCache, tenant, resourceId, account.Id, password, homeAccountId);
547547
}
548-
549-
return new InteractiveParameters(tokenCacheProvider, environment, tokenCache, tenant, resourceId, account.Id, homeAccountId, promptAction);
548+
return new InteractiveParameters(tokenCacheProvider, environment, tokenCache, tenant, resourceId, account.GetProperty("LoginHint"), homeAccountId, promptAction);
550549
}
551550

552551
return new UsernamePasswordParameters(tokenCacheProvider, environment, tokenCache, tenant, resourceId, account.Id, password, null);

src/Accounts/AuthenticationAssemblyLoadContext/AzAssemblyLoadContextInitializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static AzAssemblyLoadContextInitializer()
3232
var azSharedAssemblies = new Dictionary<string, Version>()
3333
{
3434
{"Azure.Core", new Version("1.20.0.0")},
35-
{"Azure.Identity", new Version("1.4.0.0")},
35+
{"Azure.Identity", new Version("1.5.0.0")},
3636
{"Microsoft.Bcl.AsyncInterfaces", new Version("1.0.0.0")},
3737
{"Microsoft.Identity.Client", new Version("4.30.1.0") },
3838
{"Microsoft.Identity.Client.Extensions.Msal", new Version("2.18.4.0") },

src/Accounts/Authenticators/Authenticators.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</PropertyGroup>
2424

2525
<ItemGroup>
26-
<PackageReference Include="Azure.Identity" Version="1.4.0" />
26+
<PackageReference Include="Azure.Identity" Version="1.5.0" />
2727
</ItemGroup>
2828

2929
<ItemGroup>

src/Accounts/Authenticators/InteractiveUserAuthenticator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public override Task<IAccessToken> Authenticate(AuthenticationParameters paramet
6464
TokenCachePersistenceOptions = tokenCacheProvider.GetTokenCachePersistenceOptions(),
6565
AuthorityHost = new Uri(authority),
6666
RedirectUri = GetReplyUrl(onPremise, interactiveParameters),
67+
LoginHint = interactiveParameters.UserId,
6768
};
6869
var browserCredential = new InteractiveBrowserCredential(options);
6970

Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)