Skip to content

Commit f4c2f19

Browse files
author
Hovsep
committed
Merge pull request Azure#1390 from hovsepm/dev
[#108970448] Fixed subscription.CurrentStorageAccountName display in azure cmdlets
2 parents 9a872b4 + b59f699 commit f4c2f19

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/ServiceManagement/Profile/Commands.Profile/Models/PsAzureSubscription.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ public PSAzureSubscription(AzureSubscription subscription, AzureSMProfile profil
3838
TenantId = subscription.GetPropertyAsArray(AzureSubscription.Property.Tenants).FirstOrDefault();
3939
}
4040

41-
42-
4341
public string SubscriptionId { get; set; }
4442

4543
public string SubscriptionName { get; set; }
@@ -57,5 +55,19 @@ public PSAzureSubscription(AzureSubscription subscription, AzureSMProfile profil
5755
public string CurrentStorageAccountName { get; set; }
5856

5957
public string TenantId { get; set; }
58+
59+
public string GetAccountName()
60+
{
61+
string accountName = null;
62+
63+
if (!string.IsNullOrWhiteSpace(this.CurrentStorageAccountName))
64+
{
65+
accountName = this.CurrentStorageAccountName.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)
66+
.Where(s => s.StartsWith("accountname", StringComparison.OrdinalIgnoreCase))
67+
.Select( s => s.Split(new[] { '=' }, StringSplitOptions.RemoveEmptyEntries).Last())
68+
.FirstOrDefault();
69+
}
70+
return accountName;
71+
}
6072
}
6173
}

0 commit comments

Comments
 (0)