Skip to content

Commit 04abbc0

Browse files
committed
Merge pull request #236 from Azure/clu
Clu
2 parents f150c73 + d7dd84e commit 04abbc0

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ public IAccessToken Authenticate(
6565
}
6666
else
6767
{
68+
if (account.IsPropertySet(AzureAccount.Property.ApplicationSecret))
69+
{
70+
password = password ?? account.GetProperty(AzureAccount.Property.ApplicationSecret);
71+
}
6872
token = TokenProvider.GetAccessToken(configuration, behavior, account.Id, password, account.Type);
6973
}
7074

src/CLU/Commands.Common/Models/PSAzureRmAccount.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ public static implicit operator PSAzureRmAccount(AzureAccount account)
5757
result.CertificateThumbprint = account.GetProperty(AzureAccount.Property.CertificateThumbprint);
5858
}
5959

60-
return result;
60+
if (account.IsPropertySet(AzureAccount.Property.ApplicationSecret))
61+
{
62+
result.ApplicationSecret = account.GetProperty(AzureAccount.Property.ApplicationSecret);
63+
}
64+
65+
return result;
6166
}
6267

6368
/// <summary>
@@ -99,6 +104,11 @@ public static implicit operator AzureAccount(PSAzureRmAccount account)
99104
{
100105
result.SetProperty(AzureAccount.Property.CertificateThumbprint, account.CertificateThumbprint);
101106
}
107+
108+
if (!string.IsNullOrWhiteSpace(account.ApplicationSecret))
109+
{
110+
result.SetProperty(AzureAccount.Property.ApplicationSecret, account.ApplicationSecret);
111+
}
102112
return result;
103113
}
104114

@@ -126,6 +136,8 @@ public static implicit operator AzureAccount(PSAzureRmAccount account)
126136
/// </summary>
127137
public string CertificateThumbprint { get; set; }
128138

139+
public string ApplicationSecret { get; set; }
140+
129141
public override string ToString()
130142
{
131143
return this.Id;

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,11 @@ protected override void ProcessRecord()
201201
azureAccount.SetProperty(AzureAccount.Property.Tenants, new[] { TenantId });
202202
}
203203

204+
if (!string.IsNullOrEmpty(Secret))
205+
{
206+
azureAccount.SetProperty(AzureAccount.Property.ApplicationSecret, Secret);
207+
}
208+
204209
if (DefaultProfile == null)
205210
{
206211
DefaultProfile = new AzureRMProfile();

0 commit comments

Comments
 (0)