Azure / Azure/azure-powershell
[Az.DesktopVirtualization] Get-AzWvdApplication Takes an array of subscription Ids in the parameter
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 3d 14h
- Merged PRs (30d)
- 54
Description
### Description
An array of subscription Ids won't work as you are always in the context on a single subscription
### Issue script & Debug output
```PowerShell
Get-AzWvdApplication -ApplicationGroupName $ApplicationGroupName -ResourceGroupName $ResourceGroupName -SubscriptionId ,
DEBUG: [CmdletBeginProcessing]: Starting command
DEBUG: CmdletBeginProcessing:
DEBUG: CmdletProcessRecordStart:
DEBUG: CmdletGetPipeline:
DEBUG: CmdletBeforeAPICall:
DEBUG: URLCreated: /subscriptions/d2cd2b8a-6d8f-4e4b-85ec-ef98cb93cc76/resourceGroups/DeleteMe/providers/Microsoft.DesktopVirtualization/applicationGroups/RMRail/applications?api-version=2021-07-12
DEBUG: RequestCreated: /subscriptions/d2cd2b8a-6d8f-4e4b-85ec-ef98cb93cc76/resourceGroups/DeleteMe/providers/Microsoft.DesktopVirtualization/applicationGroups/RMRail/applications?api-version=2021-07-12
DEBUG: HeaderParametersAdded:
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://management.azure.com/subscriptions/d2cd2b8a-6d8f-4e4b-85ec-ef98cb93cc76/resourceGroups/DeleteMe/providers/Microsoft.DesktopVirtualization/applicationGroups/RMRail/applications?api-version=2021-07-12
Headers:
x-ms-unique-id : 16,17,18
x-ms-client-request-id : b55a097e-1329-49e2-98bb-c9cd7db29e74
CommandName : Get-AzWvdApplication
FullCommandName : Get-AzWvdApplication_List
ParameterSetName : __AllParameterSets
User-Agent : AzurePowershell/v9.5.0,PSVersion/v7.3.3,Az.DesktopVirtualization/3.1.1
Body:
DEBUG: BeforeCall:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
Unauthorized
Headers:
Cache-Control : no-cache
Pragma : no-cache
WWW-Authenticate : Bearer authorization_uri="https://login.windows.net/8ff4448a-b2a7-4a0c-8e9c-28d7555d1dd3", error="invalid_token", error_description="The access token is from the wrong issuer. It must match the tenant associated with this subscription. Please use correct authority to get the token."
x-ms-failure-cause : gateway
x-ms-request-id : b4430c20-6ca5-4728-9daf-fdafd1592b75
x-ms-correlation-request-id : b4430c20-6ca5-4728-9daf-fdafd1592b75
x-ms-routing-request-id : UKSOUTH:20230323T120928Z:b4430c20-6ca5-4728-9daf-fdafd1592b75
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
Date : Thu, 23 Mar 2023 12:09:27 GMT
Connection : close
Body:
{
"error": {
"code": "InvalidAuthenticationTokenTenant",
"message": "The access token is from the wrong issuer 'https://sts.windows.net/6152f84d-1854-4412-8a2f-79f31cae9a49/'. It must match the tenant 'https://sts.windows.net/8ff4448a-b2a7-4a0c-8e9c-28d7555d1dd3/' associated with this subscription. Please use the authority (URL) 'https://login.windows.net/8ff4448a-b2a7-4a0c-8e9c-28d7555d1dd3' to get the token. Note, if the subscription is transferred to another tenant there is no impact to the services, but information about new tenant could take time to propagate (up to an hour). If you just transferred your subscription and see this error message, please try back later."
}
}
DEBUG: ResponseCreated:
DEBUG: BeforeResponseDispatch:
Get-AzWvdApplication_List: The access token is from the wrong issuer 'https://sts.windows.net/6152f84d-1854-4412-8a2f-79f31cae9a49/'. It must match the tenant 'https://sts.windows.net/8ff4448a-b2a7-4a0c-8e9c-28d7555d1dd3/' associated with this subscription. Please use the authority (URL) 'https://login.windows.net/8ff4448a-b2a7-4a0c-8e9c-28d7555d1dd3' to get the token. Note, if the subscription is transferred to another tenant there is no impact to the services, but information about new tenant could take time to propagate (up to an hour). If you just transferred your subscription and see this error message, please try back later.
DEBUG: [Finally]: Getting exception 'Microsoft.Azure.Commands.Common.Exceptions.AzPSCloudException: InternalException' from response
DEBUG: Finally:
DEBUG: CmdletAfterAPICall:
DEBUG: CmdletBeforeAPICall:
DEBUG: URLCreated: /subscriptions/ccf41249-3115-458a-91dd-29de280809fb/resourceGroups/DeleteMe/providers/Microsoft.DesktopVirtualization/applicationGroups/RMRail/applications?api-version=2021-07-12
DEBUG: RequestCreated: /subscriptions/ccf41249-3115-458a-91dd-29de280809fb/resourceGroups/DeleteMe/providers/Microsoft.DesktopVirtualization/applicationGroups/RMRail/applications?api-version=2021-07-12
DEBUG: HeaderParametersAdded:
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://management.azure.com/subscriptions/ccf41249-3115-458a-91dd-29de280809fb/resourceGroups/DeleteMe/providers/Microsoft.DesktopVirtualization/applicationGroups/RMRail/applications?api-version=2021-07-12
Headers:
x-ms-unique-id : 19,20,21
x-ms-client-request-id : b55a097e-1329-49e2-98bb-c9cd7db29e74
CommandName : Get-AzWvdApplication
FullCommandName : Get-AzWvdApplication_List
ParameterSetName : __AllParameterSets
User-Agent : AzurePowershell/v9.5.0,PSVersion/v7.3.3,Az.DesktopVirtualization/3.1.1
Body:
DEBUG: BeforeCall:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
NotFound
Headers:
Cache-Control : no-cache
Pragma : no-cache
x-ms-failure-cause : gateway
x-ms-request-id : 1b13e002-77e1-4b4b-abc8-ac194ee38fa5
x-ms-correlation-request-id : 1b13e002-77e1-4b4b-abc8-ac194ee38fa5
x-ms-routing-request-id : UKSOUTH:20230323T120928Z:1b13e002-77e1-4b4b-abc8-ac194ee38fa5
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
Date : Thu, 23 Mar 2023 12:09:27 GMT
Body:
{
"error": {
"code": "ResourceGroupNotFound",
"message": "Resource group 'DeleteMe' could not be found."
}
}
DEBUG: ResponseCreated:
DEBUG: BeforeResponseDispatch:
Get-AzWvdApplication_List: Resource group 'DeleteMe' could not be found.
DEBUG: Finally:
DEBUG: CmdletAfterAPICall:
DEBUG: [CmdletProcessRecordAsyncEnd]: Finish HTTP process
DEBUG: CmdletProcessRecordAsyncEnd:
DEBUG: CmdletProcessRecordEnd:
DEBUG: AzureQoSEvent: Module: Az.DesktopVirtualization:3.1.1; CommandName: Get-AzWvdApplication; PSVersion: 7.3.3; IsSuccess: False; Duration: 00:00:00.4042573; Exception: InternalException;
```
### Environment data
```PowerShell
Name Value
---- -----
PSVersion 7.3.3
PSEdition Core
GitCommitId 7.3.3
OS Microsoft Windows 10.0.22621
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
```
### Module versions
```PowerShell
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.12.1 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script 5.5.0 Az.Compute {Add-AzImageDataDisk, Add-AzVhd, Add-AzVMAdditionalUnattendContent, Add-AzVMDataDisk…}
Script 3.1.1 Az.DesktopVirtualization {Disconnect-AzWvdUserSession, Expand-AzWvdMsixImage, Get-AzWvdApplication, Get-AzWvdApplicationGroup…}
```
### Error output
```PowerShell
Message : [ResourceGroupNotFound] : Resource group 'DeleteMe' could not be found.
StackTrace :
Exception : System.Exception
InvocationInfo : {Get-AzWvdApplication_List}
Line : Get-AzWvdApplication -ApplicationGroupName $ApplicationGroupName -ResourceGroupName $ResourceGroupName -SubscriptionId d2cd2b8a-6d8f-4e4b-85ec-ef98cb93cc76, ccf41249-3115-458a-91dd-29de280809fb
Position : At line:1 char:1
+ Get-AzWvdApplication -ApplicationGroupName $ApplicationGroupName -Res …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 13
Message : [InvalidAuthenticationTokenTenant] : The access token is from the wrong issuer 'https://sts.windows.net/6152f84d-1854-4412-8a2f-79f31cae9a49/'. It must match the tenant
'https://sts.windows.net/8ff4448a-b2a7-4a0c-8e9c-28d7555d1dd3/' associated with this subscription. Please use the authority (URL) 'https://login.windows.net/8ff4448a-b2a7-4a0c-8e9c-28d7555d1dd3' to get the token.
Note, if the subscription is transferred to another tenant there is no impact to the services, but information about new tenant could take time to propagate (up to an hour). If you just transferred your subscription
and see this error message, please try back later.
StackTrace :
Exception : System.Exception
InvocationInfo : {Get-AzWvdApplication_List}
Line : Get-AzWvdApplication -ApplicationGroupName $ApplicationGroupName -ResourceGroupName $ResourceGroupName -SubscriptionId d2cd2b8a-6d8f-4e4b-85ec-ef98cb93cc76, ccf41249-3115-458a-91dd-29de280809fb
Position : At line:1 char:1
+ Get-AzWvdApplication -ApplicationGroupName $ApplicationGroupName -Res …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 13
```
Contributor guide
Research direction
Start with the Get-AzWvdApplication_List entry point and reproduce the command using multiple SubscriptionId values from the issue. Trace how each subscription is processed and verify the resulting requests and errors; done means the command's handling of an array of subscription IDs is consistent with the intended subscription context.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, powershell
- Domain
- cli, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100