Skip to content
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

Closed
wants to merge 5 commits into from

Conversation

NoriZC
Copy link
Contributor

@NoriZC NoriZC commented Sep 9, 2022

Description

Fix returning duplicate subscription ids while using Get-AzSubscription by SubscriptionName. #19427.

Checklist

  • SHOULD select appropriate branch. Cmdlets from Autorest.PowerShell should go to generation branch.
  • SHOULD make the title of PR clear and informative, and in the present imperative tense.
  • SHOULD update ChangeLog.md file(s) appropriately
    • For any service, the ChangeLog.md file can be found at src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md
    • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense. Add changelog in description section if PR goes into generation branch.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD have approved design review for the changes in this repository (Microsoft internal only) with following situations
    • Create new module from scratch
    • Create new resource types which are not easy to conform to Azure PowerShell Design Guidelines
    • Create new resource type which name doesn't use module name as prefix
    • Have design question before implementation
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT introduce breaking changes in Az minor release except preview version.
  • SHOULD NOT adjust version of module manually in pull request

Comment on lines +528 to +532
var tenants = new List<string> { DefaultTenant.ToString() };
var firstList = new List<string> { subId1 };
var secondList = new List<string> { subId2 };
var thirdList = firstList;
var fourthList = firstList;
Copy link
Contributor

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.

Comment on lines +23 to +24
## Version 2.10.1
* Fixed returning duplicate Ids for one subscription while using `Get-AzSubscription` with parameter `SubscriptionName`. [#19427]
Copy link
Contributor

Choose a reason for hiding this comment

The 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 Upcoming Release section is fine.

@@ -3,7 +3,7 @@
#
# Generated by: Microsoft Corporation
#
# Generated on: 2022/9/2
# Generated on: 9/9/2022
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to update this file manually.

@@ -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")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to update this file manually.

"Get-AzSentinelDataConnector": {},
"New-AzSentinelDataConnector": {},
"Remove-AzSentinelDataConnector": {},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to update this file manually.

[assembly: AssemblyVersion("2.10.0")]
[assembly: AssemblyFileVersion("2.10.0")]
[assembly: AssemblyVersion("2.10.1")]
[assembly: AssemblyFileVersion("2.10.1")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to update this file manually.

@@ -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")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to update this file manually.

@@ -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'; },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to update this file manually.

@@ -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'; },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to update this file manually.

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to update this file manually.

}
foreach (IAzureSubscription subscription in subscriptions)
{
if (subscriptionIds.Add(subscription.GetId()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean Contains here?

{

if(subscription is PSAzureSubscription && subscription.GetTenant() != null
&& subscription.GetHomeTenant().Equals(subscription.GetTenant()) && subscriptionIds.Add(subscription.GetId()))
Copy link
Contributor

@wyunchi-ms wyunchi-ms Sep 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean !subscriptionIds.Contains(subscription.GetId()) here?

@NoriZC NoriZC closed this Sep 13, 2022
@NoriZC NoriZC deleted the norizhang/sign branch September 13, 2022 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants