-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Az.Accounts] Fixed returning duplicate subscription ids. #19447
Changes from all commits
33ca745
9852f51
c7ebbf8
4cf99f4
52006a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
# | ||
# Generated by: Microsoft Corporation | ||
# | ||
# Generated on: 2022/9/2 | ||
# Generated on: 9/9/2022 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't need to update this file manually. |
||
# | ||
|
||
@{ | ||
|
@@ -12,7 +12,7 @@ | |
# RootModule = '' | ||
|
||
# Version number of this module. | ||
ModuleVersion = '2.10.0' | ||
ModuleVersion = '2.10.1' | ||
|
||
# Supported PSEditions | ||
CompatiblePSEditions = 'Core', 'Desktop' | ||
|
@@ -146,9 +146,7 @@ PrivateData = @{ | |
# IconUri = '' | ||
|
||
# ReleaseNotes of this module | ||
ReleaseNotes = '* Supported returning all subscriptions with specified name while using ''Get-AzSubscription'' with parameter ''SubscriptionName''. [#19295] | ||
* Fixed null reference exception when cmdlet uses AzureRestOperation [#18104] | ||
* Updated survey message and settings' | ||
ReleaseNotes = '* Fixed returning duplicate Ids for one subscription while using ''Get-AzSubscription'' with parameter ''SubscriptionName''. [#19427]' | ||
|
||
# Prerelease string of this module | ||
# Prerelease = '' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,9 @@ | |
|
||
## Upcoming Release | ||
|
||
## Version 2.10.1 | ||
* Fixed returning duplicate Ids for one subscription while using `Get-AzSubscription` with parameter `SubscriptionName`. [#19427] | ||
Comment on lines
+23
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need to update the version manually. Just add changelog content under |
||
|
||
## Version 2.10.0 | ||
* Supported returning all subscriptions with specified name while using `Get-AzSubscription` with parameter `SubscriptionName`. [#19295] | ||
* Fixed null reference exception when cmdlet uses AzureRestOperation [#18104] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -421,11 +421,30 @@ public bool TryGetSubscriptionByName(string tenantId, string subscriptionName, o | |
return subscription != null; | ||
} | ||
|
||
public bool TryGetSubscriptionListByName(string tenantId, string subscriptionName, out IEnumerable<IAzureSubscription> subscriptionList) | ||
public bool TryGetSubscriptionListByName(string tenantId, string subscriptionName, out IEnumerable<IAzureSubscription> subscriptions) | ||
{ | ||
subscriptionList = ListSubscriptions(tenantId); | ||
subscriptionList = subscriptionList.Where(s => s.Name.Equals(subscriptionName, StringComparison.OrdinalIgnoreCase)); | ||
return subscriptionList.Any(); | ||
subscriptions = ListSubscriptions(tenantId).Where(s => s.Name.Equals(subscriptionName, StringComparison.OrdinalIgnoreCase)); | ||
List<IAzureSubscription> subscriptionList = new List<IAzureSubscription>(); | ||
HashSet<Guid> subscriptionIds = new HashSet<Guid>(); | ||
foreach(IAzureSubscription subscription in subscriptions) | ||
{ | ||
|
||
if(subscription is PSAzureSubscription && subscription.GetTenant() != null | ||
&& subscription.GetHomeTenant().Equals(subscription.GetTenant()) && subscriptionIds.Add(subscription.GetId())) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean |
||
{ | ||
subscriptionList.Add(subscription); | ||
} | ||
|
||
} | ||
foreach (IAzureSubscription subscription in subscriptions) | ||
{ | ||
if (subscriptionIds.Add(subscription.GetId())) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean |
||
{ | ||
subscriptionList.Add(subscription); | ||
} | ||
} | ||
subscriptions = subscriptionList; | ||
return subscriptions.Any(); | ||
} | ||
|
||
private IAzureSubscription GetFirstSubscription(string tenantId) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,8 +43,8 @@ | |
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
|
||
[assembly: AssemblyVersion("2.10.0")] | ||
[assembly: AssemblyFileVersion("2.10.0")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't need to update this file manually. |
||
[assembly: AssemblyVersion("2.10.1")] | ||
[assembly: AssemblyFileVersion("2.10.1")] | ||
#if !SIGN | ||
[assembly: InternalsVisibleTo("Microsoft.Azure.PowerShell.Cmdlets.Accounts.Test")] | ||
#endif | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -362,6 +362,14 @@ | |
"Remove-AzAttestationPolicySigner": {} | ||
}, | ||
"Az.Automation": { | ||
"Move-AzAutomationHybridRunbookWorker": {}, | ||
"Remove-AzAutomationHybridRunbookWorker": {}, | ||
"New-AzAutomationHybridRunbookWorker": {}, | ||
"Get-AzAutomationHybridRunbookWorker": {}, | ||
"Remove-AzAutomationHybridRunbookWorkerGroup": {}, | ||
"Set-AzAutomationHybridRunbookWorkerGroup": {}, | ||
"New-AzAutomationHybridRunbookWorkerGroup": {}, | ||
"Get-AzAutomationHybridRunbookWorkerGroup": {}, | ||
"Get-AzAutomationHybridWorkerGroup": {}, | ||
"Remove-AzAutomationHybridWorkerGroup": {}, | ||
"Get-AzAutomationJobOutputRecord": {}, | ||
|
@@ -5104,30 +5112,68 @@ | |
"Set-AzSecurityAutomation": {} | ||
}, | ||
"Az.SecurityInsights": { | ||
"Get-AzSentinelAlertRuleAction": {}, | ||
"New-AzSentinelAlertRuleAction": {}, | ||
"Remove-AzSentinelAlertRuleAction": {}, | ||
"Update-AzSentinelAlertRuleAction": {}, | ||
"Get-AzSentinelAlertRule": {}, | ||
"New-AzSentinelAlertRule": {}, | ||
"Remove-AzSentinelAlertRule": {}, | ||
"Update-AzSentinelAlertRule": {}, | ||
"Get-AzSentinelAlertRuleAction": {}, | ||
"Get-AzSentinelAlertRuleTemplate": {}, | ||
"Get-AzSentinelAutomationRule": {}, | ||
"Get-AzSentinelBookmark": {}, | ||
"New-AzSentinelBookmark": {}, | ||
"Remove-AzSentinelBookmark": {}, | ||
"Update-AzSentinelBookmark": {}, | ||
"Get-AzSentinelBookmarkRelation": {}, | ||
"Get-AzSentinelDataConnector": {}, | ||
"New-AzSentinelDataConnector": {}, | ||
"Remove-AzSentinelDataConnector": {}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't need to update this file manually. |
||
"Update-AzSentinelDataConnector": {}, | ||
"Get-AzSentinelIncidentComment": {}, | ||
"New-AzSentinelIncidentComment": {}, | ||
"Get-AzSentinelEnrichment": {}, | ||
"Get-AzSentinelEntity": {}, | ||
"Get-AzSentinelEntityActivity": {}, | ||
"Get-AzSentinelEntityInsight": {}, | ||
"Get-AzSentinelEntityQuery": {}, | ||
"Get-AzSentinelEntityQueryTemplate": {}, | ||
"Get-AzSentinelEntityRelation": {}, | ||
"Get-AzSentinelEntityTimeline": {}, | ||
"Get-AzSentinelIncident": {}, | ||
"Get-AzSentinelIncidentAlert": {}, | ||
"Get-AzSentinelIncidentBookmark": {}, | ||
"Get-AzSentinelIncidentComment": {}, | ||
"Get-AzSentinelIncidentEntity": {}, | ||
"Get-AzSentinelIncidentRelation": {}, | ||
"Get-AzSentinelMetadata": {}, | ||
"Get-AzSentinelOnboardingState": {}, | ||
"Get-AzSentinelSetting": {}, | ||
"Get-AzSentinelThreatIntelligenceIndicator": {}, | ||
"Get-AzSentinelThreatIntelligenceIndicatorMetric": {}, | ||
"Invoke-AzSentinelThreatIntelligenceIndicatorQuery": {}, | ||
"New-AzSentinelAlertRule": {}, | ||
"New-AzSentinelAlertRuleAction": {}, | ||
"New-AzSentinelAutomationRule": {}, | ||
"New-AzSentinelBookmark": {}, | ||
"New-AzSentinelBookmarkRelation": {}, | ||
"New-AzSentinelDataConnector": {}, | ||
"New-AzSentinelEntityQuery": {}, | ||
"New-AzSentinelIncident": {}, | ||
"New-AzSentinelIncidentOwner": {}, | ||
"New-AzSentinelIncidentComment": {}, | ||
"New-AzSentinelIncidentRelation": {}, | ||
"New-AzSentinelIncidentTeam": {}, | ||
"New-AzSentinelOnboardingState": {}, | ||
"Remove-AzSentinelAlertRule": {}, | ||
"Remove-AzSentinelAlertRuleAction": {}, | ||
"Remove-AzSentinelAutomationRule": {}, | ||
"Remove-AzSentinelBookmark": {}, | ||
"Remove-AzSentinelBookmarkRelation": {}, | ||
"Remove-AzSentinelDataConnector": {}, | ||
"Remove-AzSentinelEntityQuery": {}, | ||
"Remove-AzSentinelIncident": {}, | ||
"Update-AzSentinelIncident": {} | ||
"Remove-AzSentinelIncidentComment": {}, | ||
"Remove-AzSentinelIncidentRelation": {}, | ||
"Remove-AzSentinelOnboardingState": {}, | ||
"Test-AzSentinelDataConnectorCheckRequirement": {}, | ||
"Update-AzSentinelAlertRule": {}, | ||
"Update-AzSentinelAlertRuleAction": {}, | ||
"Update-AzSentinelAutomationRule": {}, | ||
"Update-AzSentinelBookmark": {}, | ||
"Update-AzSentinelBookmarkRelation": {}, | ||
"Update-AzSentinelDataConnector": {}, | ||
"Update-AzSentinelEntityQuery": {}, | ||
"Update-AzSentinelIncident": {}, | ||
"Update-AzSentinelIncidentComment": {}, | ||
"Update-AzSentinelIncidentRelation": {}, | ||
"Update-AzSentinelSetting": {} | ||
}, | ||
"Az.ServiceBus": { | ||
"New-AzServiceBusNamespace": {}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,8 +43,8 @@ | |
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("2.10.0")] | ||
[assembly: AssemblyFileVersion("2.10.0")] | ||
[assembly: AssemblyVersion("2.10.1")] | ||
[assembly: AssemblyFileVersion("2.10.1")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't need to update this file manually. |
||
#if !SIGN | ||
[assembly: InternalsVisibleTo("Microsoft.Azure.PowerShell.Authentication.Test")] | ||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,5 +48,5 @@ | |
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("2.10.0")] | ||
[assembly: AssemblyFileVersion("2.10.0")] | ||
[assembly: AssemblyVersion("2.10.1")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't need to update this file manually. |
||
[assembly: AssemblyFileVersion("2.10.1")] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,7 @@ DotNetFrameworkVersion = '4.7.2' | |
# ProcessorArchitecture = '' | ||
|
||
# Modules that must be imported into the global environment prior to importing this module | ||
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.10.0'; }, | ||
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.10.1'; }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't need to update this file manually. |
||
@{ModuleName = 'Az.Advisor'; RequiredVersion = '1.1.2'; }, | ||
@{ModuleName = 'Az.Aks'; RequiredVersion = '4.3.0'; }, | ||
@{ModuleName = 'Az.AnalysisServices'; RequiredVersion = '1.1.4'; }, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,7 @@ DotNetFrameworkVersion = '4.7.2' | |
# ProcessorArchitecture = '' | ||
|
||
# Modules that must be imported into the global environment prior to importing this module | ||
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.10.0'; }, | ||
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.10.1'; }, | ||
@{ModuleName = 'Az.ADDomainServices'; RequiredVersion = '0.2.0'; }, | ||
@{ModuleName = 'Az.Advisor'; RequiredVersion = '1.1.2'; }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't need to update this file manually. |
||
@{ModuleName = 'Az.Aks'; RequiredVersion = '4.3.0'; }, | ||
|
@@ -172,7 +172,7 @@ RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.10.0'; }, | |
@{ModuleName = 'Az.Resources'; RequiredVersion = '6.2.0'; }, | ||
@{ModuleName = 'Az.Search'; RequiredVersion = '0.8.0'; }, | ||
@{ModuleName = 'Az.Security'; RequiredVersion = '1.3.0'; }, | ||
@{ModuleName = 'Az.SecurityInsights'; RequiredVersion = '1.1.0'; }, | ||
@{ModuleName = 'Az.SecurityInsights'; RequiredVersion = '2.0.0'; }, | ||
@{ModuleName = 'Az.ServiceBus'; RequiredVersion = '1.11.0'; }, | ||
@{ModuleName = 'Az.ServiceFabric'; RequiredVersion = '3.1.0'; }, | ||
@{ModuleName = 'Az.ServiceLinker'; RequiredVersion = '0.1.0'; }, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
pac0,[ps=true;customSource=https://www.powershellgallery.com/api/v2/]Az.Accounts,2.10.0 | ||
pac0,[ps=true;customSource=https://www.powershellgallery.com/api/v2/]Az.Accounts,2.10.1 | ||
pac1,[ps=true;customSource=https://www.powershellgallery.com/api/v2/]Az.ADDomainServices,0.2.0 | ||
pac2,[ps=true;customSource=https://www.powershellgallery.com/api/v2/]Az.Advisor,1.1.2 | ||
pac3,[ps=true;customSource=https://www.powershellgallery.com/api/v2/]Az.Aks,4.3.0 | ||
|
@@ -118,7 +118,7 @@ pac116,[ps=true;customSource=https://www.powershellgallery.com/api/v2/]Az.Resour | |
pac117,[ps=true;customSource=https://www.powershellgallery.com/api/v2/]Az.Resources,6.2.0 | ||
pac118,[ps=true;customSource=https://www.powershellgallery.com/api/v2/]Az.Search,0.8.0 | ||
pac119,[ps=true;customSource=https://www.powershellgallery.com/api/v2/]Az.Security,1.3.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't need to update this file manually. |
||
pac120,[ps=true;customSource=https://www.powershellgallery.com/api/v2/]Az.SecurityInsights,1.1.0 | ||
pac120,[ps=true;customSource=https://www.powershellgallery.com/api/v2/]Az.SecurityInsights,2.0.0 | ||
pac121,[ps=true;customSource=https://www.powershellgallery.com/api/v2/]Az.ServiceBus,1.11.0 | ||
pac122,[ps=true;customSource=https://www.powershellgallery.com/api/v2/]Az.ServiceFabric,3.1.0 | ||
pac123,[ps=true;customSource=https://www.powershellgallery.com/api/v2/]Az.ServiceLinker,0.1.0 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it will be better if use more meaningful variable name here.