From 0f5111862e6ac631b840a874204264a5c2bcfed1 Mon Sep 17 00:00:00 2001 From: maddieclayton Date: Mon, 8 Oct 2018 15:18:08 -0700 Subject: [PATCH 1/3] fix tenant issue --- .../Subscription/GetAzureRMSubscription.cs | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/ResourceManager/Profile/Commands.Profile/Subscription/GetAzureRMSubscription.cs b/src/ResourceManager/Profile/Commands.Profile/Subscription/GetAzureRMSubscription.cs index f20eb8a295ab..3d9f80aeea72 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Subscription/GetAzureRMSubscription.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Subscription/GetAzureRMSubscription.cs @@ -104,8 +104,24 @@ public override void ExecuteCmdlet() { try { - var subscriptions = _client.ListSubscriptions(tenant); - WriteObject(subscriptions.Select((s) => new PSAzureSubscription(s)), enumerateCollection: true); + if (DefaultContext.Account.Type.Equals("ManagedService")) + { + if (tenant == null) + { + tenant = DefaultContext.Tenant.Id; + } + + if (tenant.Equals(DefaultContext.Tenant.Id)) + { + var subscriptions = _client.ListSubscriptions(tenant); + WriteObject(subscriptions.Select((s) => new PSAzureSubscription(s)), enumerateCollection: true); + } + } + else + { + var subscriptions = _client.ListSubscriptions(tenant); + WriteObject(subscriptions.Select((s) => new PSAzureSubscription(s)), enumerateCollection: true); + } } catch (AadAuthenticationException exception) { From 9731d5466055ad6ce7cf06ecf03b6895ca6c5cf4 Mon Sep 17 00:00:00 2001 From: Maddie Clayton Date: Thu, 11 Oct 2018 13:07:30 -0700 Subject: [PATCH 2/3] Update Az.Profile.psd1 --- src/ResourceManager/Profile/Commands.Profile/Az.Profile.psd1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ResourceManager/Profile/Commands.Profile/Az.Profile.psd1 b/src/ResourceManager/Profile/Commands.Profile/Az.Profile.psd1 index 36a6c0d88c89..dea14c425773 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Az.Profile.psd1 +++ b/src/ResourceManager/Profile/Commands.Profile/Az.Profile.psd1 @@ -12,7 +12,7 @@ # RootModule = '' # Version number of this module. -ModuleVersion = '0.3.0' +ModuleVersion = '0.3.1' # Supported PSEditions CompatiblePSEditions = 'Core', 'Desktop' From 28d2e835e4d64ee3576973d4810dad23401bb6a7 Mon Sep 17 00:00:00 2001 From: maddieclayton Date: Thu, 11 Oct 2018 13:51:14 -0700 Subject: [PATCH 3/3] update changelog --- src/ResourceManager/Profile/Commands.Profile/Az.Profile.psd1 | 2 +- src/ResourceManager/Profile/Commands.Profile/ChangeLog.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ResourceManager/Profile/Commands.Profile/Az.Profile.psd1 b/src/ResourceManager/Profile/Commands.Profile/Az.Profile.psd1 index dea14c425773..36a6c0d88c89 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Az.Profile.psd1 +++ b/src/ResourceManager/Profile/Commands.Profile/Az.Profile.psd1 @@ -12,7 +12,7 @@ # RootModule = '' # Version number of this module. -ModuleVersion = '0.3.1' +ModuleVersion = '0.3.0' # Supported PSEditions CompatiblePSEditions = 'Core', 'Desktop' diff --git a/src/ResourceManager/Profile/Commands.Profile/ChangeLog.md b/src/ResourceManager/Profile/Commands.Profile/ChangeLog.md index b412e1ad06fd..4143ac792613 100644 --- a/src/ResourceManager/Profile/Commands.Profile/ChangeLog.md +++ b/src/ResourceManager/Profile/Commands.Profile/ChangeLog.md @@ -18,6 +18,7 @@ - Additional information about change #1 --> ## Current Release +* Fix issue with Get-AzureRmSubscription in CloudShell ## Version 5.6.0 * Minor changes to the storage common code