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

Get-AzSubscription in 2.10.0 is returning duplicate ids for one subscription. #19427

Closed
amitdwivedi-broadcom opened this issue Sep 7, 2022 · 10 comments · Fixed by #19450
Closed
Assignees
Labels
Accounts Issues in Az.Accounts except authentication related Azure PS Team bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported

Comments

@amitdwivedi-broadcom
Copy link

amitdwivedi-broadcom commented Sep 7, 2022

Description

Wrong output for Get-AzSubscription -SubscriptionName in 2.10.0 version its returning array of IDs for one subscription. Where as in 2.9.1 it was returning only one id. Kindly fix this at the earliest as this is breaking changes for our customer

Issue script & Debug output

PS /home/amit> Get-InstalledModule|grep Az.Accounts                                          
2.10.0               Az.Accounts                         /usr/cloudshell/temp Microsoft Azure PowerShell - Accounts credential management cmdlets for Azure Resource Manager in Win…
PS /home/amit> (Get-AzSubscription -SubscriptionName "606303-2A - NIS - DLP testing").ID
d8e556db-074e-4a5f-a34a-bc1dbc554039
d8e556db-074e-4a5f-a34a-bc1dbc554039
PS /home/amit> 




For old library - 2.9.1 the output is right
PS /Users/ad731973/Downloads> (Get-AzSubscription -SubscriptionName "606303-2A - NIS - DLP testing").ID
d8e556db-074e-4a5f-a34a-bc1dbc554039
PS /Users/ad731973/Downloads> Get-Module Az*                                                                    

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.9.1                 Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script     1.3.0                 Az.EventGrid                        {Get-AzEventGridDomain, Get-AzEventGridDomainKey, Get-AzEventGridDomainTopic, Get-AzEventGridSubscription…}
Script     6.1.0                 Az.Resources                        {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAssignment, Get-AzDeployment…}
Script     4.8.0                 Az.Storage                          {Add-AzRmStorageContainerLegalHold, Add-AzStorageAccountManagementPolicyAction, Add-AzStorageAccountNetworkRule, Close-AzStorageFileHandle…}

Environment data

PS /home/amit> $PsVersionTable

Name                           Value
----                           -----
PSVersion                      7.2.5
PSEdition                      Core
GitCommitId                    7.2.5
OS                             Linux 5.4.0-1090-azure #95~18.04.1-Ubuntu SMP Sun Aug 14 20:09:27 UTC 2022
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

PS /home/amit> Get-Module Az*

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.10.0                Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script     4.31.0                Az.Compute                          {Add-AzImageDataDisk, Add-AzVhd, Add-AzVMAdditionalUnattendContent, Add-AzVMDataDisk…}
Script     4.20.1                Az.Network                          {Add-AzApplicationGatewayAuthenticationCertificate, Add-AzApplicationGatewayBackendAddressPool, Add-AzApplica…
Script     5.3.1                 Az.Resources                        {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAssignment, Get-AzDeployment…}
Script     4.9.0                 Az.Storage                          {Add-AzRmStorageContainerLegalHold, Add-AzStorageAccountManagementPolicyAction, Add-AzStorageAccountNetworkRu…
Script     0.0.0.10              AzureAD.Standard.Preview            {Add-AzureADApplicationOwner, Add-AzureADDeviceRegisteredOwner, Add-AzureADDeviceRegisteredUser, Add-AzureADD…
Script     0.9.3                 AzurePSDrive

Error output

PS /home/amit> (Get-AzSubscription -SubscriptionName "606303-2A - NIS - DLP testing")

Name Id TenantId State


606303-2A - NIS - DLP testing d8e556db-074e-4a5f-a34a-bc1dbc554039 98315c53-5479-4f79-adb3-9b7c4ed1c330 Enabled
606303-2A - NIS - DLP testing d8e556db-074e-4a5f-a34a-bc1dbc554039 2b21c6e6-e674-4f82-bd36-d73d35d4cf6c Enabled

No response

@amitdwivedi-broadcom amitdwivedi-broadcom added bug This issue requires a change to an existing behavior in the product in order to be resolved. needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Sep 7, 2022
@ghost ghost added customer-reported and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Sep 7, 2022
@dingmeng-xue
Copy link
Member

@amitdwivedi-broadcom , thanks for reporting. It should be a bug.

Could you check issue environment? I suspect user has multiple tenants and subscription 606303-2A - NIS - DLP testing belongs to one tenant and projects to another tenant. Please help check that.

@dingmeng-xue dingmeng-xue added the Accounts Issues in Az.Accounts except authentication related label Sep 7, 2022
@amitdwivedi-broadcom
Copy link
Author

How come this issue is not there in 2.9.1 then?

@amitdwivedi-broadcom
Copy link
Author

This issue only came up after 2.10.0 which was released 6hrs before, Also this user does have multiple tenants and subscriptions too but id for a subscription should only be one. Isnt it?

@dingmeng-xue
Copy link
Member

@amitdwivedi-broadcom I can confirm this issue is due to fix of #19295 . Our test environment cannot cover all user scenarios. So, we want to confirm the root cause. It will help to ensure the fix more safe.

@dingmeng-xue
Copy link
Member

@amitdwivedi-broadcom , could you check output of Get-AzSubscription -SubscriptionName "606303-2A - NIS - DLP testing". Do 2 records have the same tenant id or not?

@amitdwivedi-broadcom
Copy link
Author

amitdwivedi-broadcom commented Sep 8, 2022 via email

@dingmeng-xue
Copy link
Member

Correct. the same subscription links to multiple tenants. We will fix it.

@NoriZC
Copy link
Contributor

NoriZC commented Sep 10, 2022

Hi @amitdwivedi-broadcom ,
The Engineer build for this issue is ready. Please give it a test in your environment and let us know if it's OK to publish.

How to install:

  • Install the Az.Tools.Installer module.

    Install-Module -Name Az.Tools.Installer -Repository PSGallery
  • Use Az.Tools.Installer to install the OOB build.

    Install-AzModule -Path https://azposhpreview.blob.core.windows.net/public/Az.Accounts.2.10.1.nupkg

Please notice that this link is temporarily valid and will be deleted after next release.

@amitdwivedi-broadcom
Copy link
Author

amitdwivedi-broadcom commented Sep 12, 2022 via email

@NoriZC
Copy link
Contributor

NoriZC commented Sep 14, 2022

Hi @amitdwivedi-broadcom,
The official Az.Accounts v2.10.1 has been published now:

The issue has been resolved. Feel free to reach out if you have other questions, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accounts Issues in Az.Accounts except authentication related Azure PS Team bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants