From a86383da4dfdde83bbf4e29a7eeb2660f5026201 Mon Sep 17 00:00:00 2001 From: Pooneh Date: Wed, 31 Dec 2014 09:38:26 -0800 Subject: [PATCH 1/2] adding tenant ID to the output properties of Get-AzureSubscription cmdlet --- src/Common/Commands.Profile/Models/PsAzureSubscription.cs | 1 + src/Common/Commands.Profile/Subscription/GetAzureSubscription.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Common/Commands.Profile/Models/PsAzureSubscription.cs b/src/Common/Commands.Profile/Models/PsAzureSubscription.cs index 3c2d72096935..9a549b133113 100644 --- a/src/Common/Commands.Profile/Models/PsAzureSubscription.cs +++ b/src/Common/Commands.Profile/Models/PsAzureSubscription.cs @@ -27,5 +27,6 @@ public class PSAzureSubscription public bool IsDefault { get; set; } public bool IsCurrent { get; set; } public string CurrentStorageAccountName { get; set; } + public string TenantId { get; set; } } } diff --git a/src/Common/Commands.Profile/Subscription/GetAzureSubscription.cs b/src/Common/Commands.Profile/Subscription/GetAzureSubscription.cs index ad91a7d22a46..e1cc0fec753d 100644 --- a/src/Common/Commands.Profile/Subscription/GetAzureSubscription.cs +++ b/src/Common/Commands.Profile/Subscription/GetAzureSubscription.cs @@ -150,6 +150,7 @@ private PSAzureSubscription ConstructPsAzureSubscription(AzureSubscription subsc psObject.IsDefault = subscription.IsPropertySet(AzureSubscription.Property.Default); psObject.IsCurrent = AzureSession.CurrentContext.Subscription != null && AzureSession.CurrentContext.Subscription.Id == subscription.Id; psObject.CurrentStorageAccountName = subscription.GetProperty(AzureSubscription.Property.StorageAccount); + psObject.TenantId = subscription.GetProperty(AzureSubscription.Property.Tenants); return psObject; } From 299e79a86aa7d9e4c2ba13f351baeaf6acd4e900 Mon Sep 17 00:00:00 2001 From: Pooneh Date: Fri, 2 Jan 2015 12:07:53 -0800 Subject: [PATCH 2/2] Getting the first or default tenant ID of a subscription --- .../Commands.Profile/Subscription/GetAzureSubscription.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Common/Commands.Profile/Subscription/GetAzureSubscription.cs b/src/Common/Commands.Profile/Subscription/GetAzureSubscription.cs index e1cc0fec753d..39670163cf34 100644 --- a/src/Common/Commands.Profile/Subscription/GetAzureSubscription.cs +++ b/src/Common/Commands.Profile/Subscription/GetAzureSubscription.cs @@ -150,7 +150,7 @@ private PSAzureSubscription ConstructPsAzureSubscription(AzureSubscription subsc psObject.IsDefault = subscription.IsPropertySet(AzureSubscription.Property.Default); psObject.IsCurrent = AzureSession.CurrentContext.Subscription != null && AzureSession.CurrentContext.Subscription.Id == subscription.Id; psObject.CurrentStorageAccountName = subscription.GetProperty(AzureSubscription.Property.StorageAccount); - psObject.TenantId = subscription.GetProperty(AzureSubscription.Property.Tenants); + psObject.TenantId = subscription.GetPropertyAsArray(AzureSubscription.Property.Tenants).FirstOrDefault(); return psObject; }