admin管理员组

文章数量:1391929

Module: Az; v13.3.0, v10.4.1
Module: Az.DesktopVirtualization; v5.4.1
Powershell: v7.5.0, v5.1

Trying to run Get-AzWvdHostPool against my Azure environment throws an error that I haven't seen before:

> Get-AzWvdHostPool -Debug
DEBUG: 2:50:00 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 2:50:00 PM - GetAzureRMContextCommand begin processing with ParameterSet 'GetSingleContext'.
DEBUG: 2:50:00 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [Az.Accounts], Cmdlet = [Get-AzContext]. Returning default value [True].
DEBUG: 2:50:00 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 2:50:00 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 2:50:00 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 2:50:00 PM - GetAzureRMContextCommand end processing.
DEBUG: [CmdletBeginProcessing]: Starting command
DEBUG: CmdletBeginProcessing:
DEBUG: CmdletProcessRecordStart:
DEBUG: CmdletGetPipeline:
DEBUG: CmdletBeforeAPICall:
DEBUG: URLCreated: /subscriptions/****/providers/Microsoft.DesktopVirtualization/hostPools?api-version=2024-04-03
DEBUG: RequestCreated: /subscriptions/****/providers/Microsoft.DesktopVirtualization/hostPools?api-version=2024-04-03
DEBUG: HeaderParametersAdded:
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
/****/providers/Microsoft.DesktopVirtualization/hostPools?api-version=2024-04-03

Headers:
x-ms-unique-id                : 8
x-ms-client-request-id        : 4b763d09-07a0-4019-bece-b2c049dacd64
CommandName                   : Get-AzWvdHostPool
FullCommandName               : Get-AzWvdHostPool_List1
ParameterSetName              : __AllParameterSets
User-Agent                    : AzurePowershell/v10.4.1,PSVersion/v7.5.0,Az.DesktopVirtualization/5.4.0

Body:



DEBUG: 2:50:00 PM - [ConfigManager] Got nothing from [DisableInstanceDiscovery], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: BeforeCall:
DEBUG: 2:50:00 PM - [ConfigManager] Got nothing from [EnableLoginByWam], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
NotFound

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
x-ms-failure-cause            : gateway
x-ms-request-id               : fce33bfc-c823-4b8d-8988-c4857e002fe7
x-ms-correlation-request-id   : fce33bfc-c823-4b8d-8988-c4857e002fe7
x-ms-routing-request-id       : USDODEAST:20250312T185000Z:fce33bfc-c823-4b8d-8988-c4857e002fe7
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
Date                          : Wed, 12 Mar 2025 18:49:59 GMT

Body:
{
  "error": {
    "code": "InvalidResourceType",
    "message": "The resource type 'hostpools' could not be found in the namespace 'Microsoft.DesktopVirtualization' for api version '2024-04-03'. The supported api-versions are '2019-01-23-preview,2019-09-24-preview,2019-12-10-preview,2020-09-21-preview,2020-10-19-preview,2020-11-02-preview,2020-11-10-preview,2021-01-14-preview,2021-02-01-preview,2021-03-09-preview,2021-04-01-preview,2021-05-13-preview,2021-08-04-preview,2021-09-03-preview,2021-09-17-privatepreview,2022-01-12-privatepreview,2022-02-10-preview,2022-04-01-preview,2022-07-05-preview,2022-08-09-privatepreview,2022-09-01-privatepreview,2022-10-14-preview,2022-12-09-privatepreview,2023-01-28-privatepreview,2023-01-30-preview,2023-03-03-privatepreview,2023-03-21-privatepreview,2023-03-30-privatepreview,2023-04-06-preview,2023-05-15-privatepreview,2023-05-18-privatepreview,2023-07-07-preview,2023-10-04-preview,2023-10-09-privatepreview,2023-11-01-preview,2023-11-29-privatepreview,2024-01-16-preview,2021-07-12,2022-09-09,2023-09-05'."
  }
}


DEBUG: ResponseCreated:
DEBUG: BeforeResponseDispatch:
Get-AzWvdHostPool_List1: The resource type 'hostpools' could not be found in the namespace 'Microsoft.DesktopVirtualization' for api version '2024-04-03'. The supported api-versions are '2019-01-23-preview,2019-09-24-preview,2019-12-10-preview,2020-09-21-preview,2020-10-19-preview,2020-11-02-preview,2020-11-10-preview,2021-01-14-preview,2021-02-01-preview,2021-03-09-preview,2021-04-01-preview,2021-05-13-preview,2021-08-04-preview,2021-09-03-preview,2021-09-17-privatepreview,2022-01-12-privatepreview,2022-02-10-preview,2022-04-01-preview,2022-07-05-preview,2022-08-09-privatepreview,2022-09-01-privatepreview,2022-10-14-preview,2022-12-09-privatepreview,2023-01-28-privatepreview,2023-01-30-preview,2023-03-03-privatepreview,2023-03-21-privatepreview,2023-03-30-privatepreview,2023-04-06-preview,2023-05-15-privatepreview,2023-05-18-privatepreview,2023-07-07-preview,2023-10-04-preview,2023-10-09-privatepreview,2023-11-01-preview,2023-11-29-privatepreview,2024-01-16-preview,2021-07-12,2022-09-09,2023-09-05'.
DEBUG: [Finally]: Getting exception 'Microsoft.Azure.Commands.Common.Exceptions.AzPSResourceNotFoundCloudException: InternalException' from response
DEBUG: Finally:
DEBUG: CmdletAfterAPICall:
DEBUG: [CmdletProcessRecordAsyncEnd]: Finish HTTP process
DEBUG: CmdletProcessRecordAsyncEnd:
DEBUG: CmdletProcessRecordEnd:
DEBUG: AzureQoSEvent:  Module: Az.DesktopVirtualization:5.4.1; CommandName: Get-AzWvdHostPool; PSVersion: 7.5.0; IsSuccess: False; Duration: 00:00:00.5129497; SanitizeDuration: 00:00:00; Exception: InternalException;

Things I've tried:

  • Updating the Az module
  • Downgraded the module to a version I know to have worked: 10.4.1; Did not fix the problem
  • Ran the same command as both a regular and admin user
  • Ran the command in Powershell Core 7.5.0 and Windows Powershell 5.1
  • Confirmed that the cmdlet is still available in the latest version of the module
  • Checked the available API versions which doesn't list 2024-04-03. Curiously, it doesn't list the version that I used in a workaround, either (see below). This also validates that the hostpool resource type is available in the module version
> (Get-AzResourceProvider -ProviderNamespace "Microsoft.DesktopVirtualization").ResourceTypes | Where-Object ResourceTypeName -eq "hostpools" | Select-Object -ExpandProperty ApiVersions
2024-01-16-preview
2023-11-29-privatepreview
2023-11-01-preview
2023-10-09-privatepreview
2023-10-04-preview
2023-09-05
2023-07-07-preview
2023-05-18-privatepreview
2023-05-15-privatepreview
2023-04-06-preview
2023-03-30-privatepreview
2023-03-21-privatepreview
2023-03-03-privatepreview
2023-01-30-preview
2023-01-28-privatepreview
2022-12-09-privatepreview
2022-10-14-preview
2022-09-09
2022-09-01-privatepreview
2022-08-09-privatepreview
2022-07-05-preview
2022-04-01-preview
2022-02-10-preview
2022-01-12-privatepreview
2021-09-17-privatepreview
2021-09-03-preview
2021-08-04-preview
2021-07-12
2021-05-13-preview
2021-04-01-preview
2021-03-09-preview
2021-02-01-preview
2021-01-14-preview
2020-11-10-preview
2020-11-02-preview
2020-10-19-preview
2020-09-21-preview
2019-12-10-preview
2019-09-24-preview
2019-01-23-preview

The workaround is to call the resource directly using Get-Resource and supply a functioning API version. Below, I use an even newer version of the API.

Get-AzResource -ResourceType "Microsoft.DesktopVirtualization/hostpools" -ApiVersion "2024-07-01"

Related, but as an aside, running a different command, Get-AzWvdSessionHost, throws a different error:

> Get-AzWvdSessionHost -HostPoolName CACSTST-Hostpool-0809 -ResourceGroupName "ESOC-AVD-BLUE" -Debug
DEBUG: 2:34:44 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 2:34:44 PM - GetAzureRMContextCommand begin processing with ParameterSet 'GetSingleContext'.
DEBUG: 2:34:44 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [Az.Accounts], Cmdlet = [Get-AzContext]. Returning default value [True].
DEBUG: 2:34:44 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 2:34:44 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 2:34:44 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 2:34:44 PM - GetAzureRMContextCommand end processing.
DEBUG: [CmdletBeginProcessing]: Starting command
DEBUG: CmdletBeginProcessing:
DEBUG: CmdletProcessRecordStart:
DEBUG: CmdletGetPipeline:
DEBUG: CmdletBeforeAPICall:
DEBUG: URLCreated: /subscriptions/****/resourceGroups/****/providers/Microsoft.DesktopVirtualization/hostPools/****/sessionHosts?api-version=2024-04-03
DEBUG: RequestCreated: /subscriptions/****/resourceGroups/****/providers/Microsoft.DesktopVirtualization/hostPools/****/sessionHosts?api-version=2024-04-03
DEBUG: HeaderParametersAdded:
DEBUG: 2:34:44 PM - [ConfigManager] Got nothing from [DisableInstanceDiscovery], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
/****/resourceGroups/****/providers/Microsoft.DesktopVirtualization/hostPools/****/sessionHosts?api-version=2024-04-03

Headers:
x-ms-unique-id                : 6
x-ms-client-request-id        : 209e261e-965f-4872-a45c-0987a956b6c8
CommandName                   : Get-AzWvdSessionHost
FullCommandName               : Get-AzWvdSessionHost_List
ParameterSetName              : __AllParameterSets
User-Agent                    : AzurePowershell/v10.4.1,PSVersion/v7.5.0,Az.DesktopVirtualization/5.4.0

Body:



DEBUG: 2:34:44 PM - [ConfigManager] Got nothing from [EnableLoginByWam], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: BeforeCall:
DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
BadRequest

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
x-ms-failure-cause            : gateway
x-ms-request-id               : 172e57cb-729b-4035-b469-91449b6c696d
x-ms-correlation-request-id   : 172e57cb-729b-4035-b469-91449b6c696d
x-ms-routing-request-id       : USDODEAST:20250312T183444Z:172e57cb-729b-4035-b469-91449b6c696d
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
Date                          : Wed, 12 Mar 2025 18:34:43 GMT

Body:
{
  "error": {
    "code": "NoRegisteredProviderFound",
    "message": "No registered resource provider found for location 'usgovvirginia' and API version '2024-04-03' for type 'hostpools/sessionhosts'. The supported api-versions are '2019-01-23-preview, 2019-09-24-preview, 2019-12-10-preview, 2020-09-21-preview, 2020-10-19-preview, 2020-11-02-preview, 2020-11-10-preview, 2021-01-14-preview, 2021-02-01-preview, 2021-03-09-preview, 2021-04-01-preview, 2021-05-13-preview, 2021-08-04-preview, 2021-09-03-preview, 2021-09-17-privatepreview, 2022-01-12-privatepreview, 2022-02-10-preview, 2022-04-01-preview, 2022-07-05-preview, 2022-08-09-privatepreview, 2022-09-01-privatepreview, 2022-10-14-preview, 2022-12-09-privatepreview, 2023-01-28-privatepreview, 2023-01-30-preview, 2023-03-03-privatepreview, 2023-03-21-privatepreview, 2023-03-30-privatepreview, 2023-04-06-preview, 2023-05-15-privatepreview, 2023-05-18-privatepreview, 2023-07-07-preview, 2023-10-04-preview, 2023-10-09-privatepreview, 2023-11-01-preview, 2023-11-29-privatepreview, 2024-01-16-preview, 2021-07-12, 2022-09-09, 2023-09-05'. The supported locations are 'usgovarizona, usgovvirginia'."
  }
}


DEBUG: ResponseCreated:
DEBUG: BeforeResponseDispatch:
Get-AzWvdSessionHost_List: No registered resource provider found for location 'usgovvirginia' and API version '2024-04-03' for type 'hostpools/sessionhosts'. The supported api-versions are '2019-01-23-preview, 2019-09-24-preview, 2019-12-10-preview, 2020-09-21-preview, 2020-10-19-preview, 2020-11-02-preview, 2020-11-10-preview, 2021-01-14-preview, 2021-02-01-preview, 2021-03-09-preview, 2021-04-01-preview, 2021-05-13-preview, 2021-08-04-preview, 2021-09-03-preview, 2021-09-17-privatepreview, 2022-01-12-privatepreview, 2022-02-10-preview, 2022-04-01-preview, 2022-07-05-preview, 2022-08-09-privatepreview, 2022-09-01-privatepreview, 2022-10-14-preview, 2022-12-09-privatepreview, 2023-01-28-privatepreview, 2023-01-30-preview, 2023-03-03-privatepreview, 2023-03-21-privatepreview, 2023-03-30-privatepreview, 2023-04-06-preview, 2023-05-15-privatepreview, 2023-05-18-privatepreview, 2023-07-07-preview, 2023-10-04-preview, 2023-10-09-privatepreview, 2023-11-01-preview, 2023-11-29-privatepreview, 2024-01-16-preview, 2021-07-12, 2022-09-09, 2023-09-05'. The supported locations are 'usgovarizona, usgovvirginia'.
DEBUG: [Finally]: Getting exception 'Microsoft.Azure.Commands.Common.Exceptions.AzPSCloudException: InternalException' from response
DEBUG: Finally:
DEBUG: CmdletAfterAPICall:
DEBUG: [CmdletProcessRecordAsyncEnd]: Finish HTTP process
DEBUG: CmdletProcessRecordAsyncEnd:
DEBUG: CmdletProcessRecordEnd:
DEBUG: AzureQoSEvent:  Module: Az.DesktopVirtualization:5.4.1; CommandName: Get-AzWvdSessionHost; PSVersion: 7.5.0; IsSuccess: False; Duration: 00:00:00.4905912; SanitizeDuration: 00:00:00; Exception: InternalException;

Is this a proper bug that I should report or just an issue with my workspace?

Module: Az; v13.3.0, v10.4.1
Module: Az.DesktopVirtualization; v5.4.1
Powershell: v7.5.0, v5.1

Trying to run Get-AzWvdHostPool against my Azure environment throws an error that I haven't seen before:

> Get-AzWvdHostPool -Debug
DEBUG: 2:50:00 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 2:50:00 PM - GetAzureRMContextCommand begin processing with ParameterSet 'GetSingleContext'.
DEBUG: 2:50:00 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [Az.Accounts], Cmdlet = [Get-AzContext]. Returning default value [True].
DEBUG: 2:50:00 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 2:50:00 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 2:50:00 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 2:50:00 PM - GetAzureRMContextCommand end processing.
DEBUG: [CmdletBeginProcessing]: Starting command
DEBUG: CmdletBeginProcessing:
DEBUG: CmdletProcessRecordStart:
DEBUG: CmdletGetPipeline:
DEBUG: CmdletBeforeAPICall:
DEBUG: URLCreated: /subscriptions/****/providers/Microsoft.DesktopVirtualization/hostPools?api-version=2024-04-03
DEBUG: RequestCreated: /subscriptions/****/providers/Microsoft.DesktopVirtualization/hostPools?api-version=2024-04-03
DEBUG: HeaderParametersAdded:
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.usgovcloudapi/subscriptions/****/providers/Microsoft.DesktopVirtualization/hostPools?api-version=2024-04-03

Headers:
x-ms-unique-id                : 8
x-ms-client-request-id        : 4b763d09-07a0-4019-bece-b2c049dacd64
CommandName                   : Get-AzWvdHostPool
FullCommandName               : Get-AzWvdHostPool_List1
ParameterSetName              : __AllParameterSets
User-Agent                    : AzurePowershell/v10.4.1,PSVersion/v7.5.0,Az.DesktopVirtualization/5.4.0

Body:



DEBUG: 2:50:00 PM - [ConfigManager] Got nothing from [DisableInstanceDiscovery], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: BeforeCall:
DEBUG: 2:50:00 PM - [ConfigManager] Got nothing from [EnableLoginByWam], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
NotFound

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
x-ms-failure-cause            : gateway
x-ms-request-id               : fce33bfc-c823-4b8d-8988-c4857e002fe7
x-ms-correlation-request-id   : fce33bfc-c823-4b8d-8988-c4857e002fe7
x-ms-routing-request-id       : USDODEAST:20250312T185000Z:fce33bfc-c823-4b8d-8988-c4857e002fe7
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
Date                          : Wed, 12 Mar 2025 18:49:59 GMT

Body:
{
  "error": {
    "code": "InvalidResourceType",
    "message": "The resource type 'hostpools' could not be found in the namespace 'Microsoft.DesktopVirtualization' for api version '2024-04-03'. The supported api-versions are '2019-01-23-preview,2019-09-24-preview,2019-12-10-preview,2020-09-21-preview,2020-10-19-preview,2020-11-02-preview,2020-11-10-preview,2021-01-14-preview,2021-02-01-preview,2021-03-09-preview,2021-04-01-preview,2021-05-13-preview,2021-08-04-preview,2021-09-03-preview,2021-09-17-privatepreview,2022-01-12-privatepreview,2022-02-10-preview,2022-04-01-preview,2022-07-05-preview,2022-08-09-privatepreview,2022-09-01-privatepreview,2022-10-14-preview,2022-12-09-privatepreview,2023-01-28-privatepreview,2023-01-30-preview,2023-03-03-privatepreview,2023-03-21-privatepreview,2023-03-30-privatepreview,2023-04-06-preview,2023-05-15-privatepreview,2023-05-18-privatepreview,2023-07-07-preview,2023-10-04-preview,2023-10-09-privatepreview,2023-11-01-preview,2023-11-29-privatepreview,2024-01-16-preview,2021-07-12,2022-09-09,2023-09-05'."
  }
}


DEBUG: ResponseCreated:
DEBUG: BeforeResponseDispatch:
Get-AzWvdHostPool_List1: The resource type 'hostpools' could not be found in the namespace 'Microsoft.DesktopVirtualization' for api version '2024-04-03'. The supported api-versions are '2019-01-23-preview,2019-09-24-preview,2019-12-10-preview,2020-09-21-preview,2020-10-19-preview,2020-11-02-preview,2020-11-10-preview,2021-01-14-preview,2021-02-01-preview,2021-03-09-preview,2021-04-01-preview,2021-05-13-preview,2021-08-04-preview,2021-09-03-preview,2021-09-17-privatepreview,2022-01-12-privatepreview,2022-02-10-preview,2022-04-01-preview,2022-07-05-preview,2022-08-09-privatepreview,2022-09-01-privatepreview,2022-10-14-preview,2022-12-09-privatepreview,2023-01-28-privatepreview,2023-01-30-preview,2023-03-03-privatepreview,2023-03-21-privatepreview,2023-03-30-privatepreview,2023-04-06-preview,2023-05-15-privatepreview,2023-05-18-privatepreview,2023-07-07-preview,2023-10-04-preview,2023-10-09-privatepreview,2023-11-01-preview,2023-11-29-privatepreview,2024-01-16-preview,2021-07-12,2022-09-09,2023-09-05'.
DEBUG: [Finally]: Getting exception 'Microsoft.Azure.Commands.Common.Exceptions.AzPSResourceNotFoundCloudException: InternalException' from response
DEBUG: Finally:
DEBUG: CmdletAfterAPICall:
DEBUG: [CmdletProcessRecordAsyncEnd]: Finish HTTP process
DEBUG: CmdletProcessRecordAsyncEnd:
DEBUG: CmdletProcessRecordEnd:
DEBUG: AzureQoSEvent:  Module: Az.DesktopVirtualization:5.4.1; CommandName: Get-AzWvdHostPool; PSVersion: 7.5.0; IsSuccess: False; Duration: 00:00:00.5129497; SanitizeDuration: 00:00:00; Exception: InternalException;

Things I've tried:

  • Updating the Az module
  • Downgraded the module to a version I know to have worked: 10.4.1; Did not fix the problem
  • Ran the same command as both a regular and admin user
  • Ran the command in Powershell Core 7.5.0 and Windows Powershell 5.1
  • Confirmed that the cmdlet is still available in the latest version of the module
  • Checked the available API versions which doesn't list 2024-04-03. Curiously, it doesn't list the version that I used in a workaround, either (see below). This also validates that the hostpool resource type is available in the module version
> (Get-AzResourceProvider -ProviderNamespace "Microsoft.DesktopVirtualization").ResourceTypes | Where-Object ResourceTypeName -eq "hostpools" | Select-Object -ExpandProperty ApiVersions
2024-01-16-preview
2023-11-29-privatepreview
2023-11-01-preview
2023-10-09-privatepreview
2023-10-04-preview
2023-09-05
2023-07-07-preview
2023-05-18-privatepreview
2023-05-15-privatepreview
2023-04-06-preview
2023-03-30-privatepreview
2023-03-21-privatepreview
2023-03-03-privatepreview
2023-01-30-preview
2023-01-28-privatepreview
2022-12-09-privatepreview
2022-10-14-preview
2022-09-09
2022-09-01-privatepreview
2022-08-09-privatepreview
2022-07-05-preview
2022-04-01-preview
2022-02-10-preview
2022-01-12-privatepreview
2021-09-17-privatepreview
2021-09-03-preview
2021-08-04-preview
2021-07-12
2021-05-13-preview
2021-04-01-preview
2021-03-09-preview
2021-02-01-preview
2021-01-14-preview
2020-11-10-preview
2020-11-02-preview
2020-10-19-preview
2020-09-21-preview
2019-12-10-preview
2019-09-24-preview
2019-01-23-preview

The workaround is to call the resource directly using Get-Resource and supply a functioning API version. Below, I use an even newer version of the API.

Get-AzResource -ResourceType "Microsoft.DesktopVirtualization/hostpools" -ApiVersion "2024-07-01"

Related, but as an aside, running a different command, Get-AzWvdSessionHost, throws a different error:

> Get-AzWvdSessionHost -HostPoolName CACSTST-Hostpool-0809 -ResourceGroupName "ESOC-AVD-BLUE" -Debug
DEBUG: 2:34:44 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 2:34:44 PM - GetAzureRMContextCommand begin processing with ParameterSet 'GetSingleContext'.
DEBUG: 2:34:44 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [Az.Accounts], Cmdlet = [Get-AzContext]. Returning default value [True].
DEBUG: 2:34:44 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 2:34:44 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 2:34:44 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 2:34:44 PM - GetAzureRMContextCommand end processing.
DEBUG: [CmdletBeginProcessing]: Starting command
DEBUG: CmdletBeginProcessing:
DEBUG: CmdletProcessRecordStart:
DEBUG: CmdletGetPipeline:
DEBUG: CmdletBeforeAPICall:
DEBUG: URLCreated: /subscriptions/****/resourceGroups/****/providers/Microsoft.DesktopVirtualization/hostPools/****/sessionHosts?api-version=2024-04-03
DEBUG: RequestCreated: /subscriptions/****/resourceGroups/****/providers/Microsoft.DesktopVirtualization/hostPools/****/sessionHosts?api-version=2024-04-03
DEBUG: HeaderParametersAdded:
DEBUG: 2:34:44 PM - [ConfigManager] Got nothing from [DisableInstanceDiscovery], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.usgovcloudapi/subscriptions/****/resourceGroups/****/providers/Microsoft.DesktopVirtualization/hostPools/****/sessionHosts?api-version=2024-04-03

Headers:
x-ms-unique-id                : 6
x-ms-client-request-id        : 209e261e-965f-4872-a45c-0987a956b6c8
CommandName                   : Get-AzWvdSessionHost
FullCommandName               : Get-AzWvdSessionHost_List
ParameterSetName              : __AllParameterSets
User-Agent                    : AzurePowershell/v10.4.1,PSVersion/v7.5.0,Az.DesktopVirtualization/5.4.0

Body:



DEBUG: 2:34:44 PM - [ConfigManager] Got nothing from [EnableLoginByWam], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: BeforeCall:
DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
BadRequest

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
x-ms-failure-cause            : gateway
x-ms-request-id               : 172e57cb-729b-4035-b469-91449b6c696d
x-ms-correlation-request-id   : 172e57cb-729b-4035-b469-91449b6c696d
x-ms-routing-request-id       : USDODEAST:20250312T183444Z:172e57cb-729b-4035-b469-91449b6c696d
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
Date                          : Wed, 12 Mar 2025 18:34:43 GMT

Body:
{
  "error": {
    "code": "NoRegisteredProviderFound",
    "message": "No registered resource provider found for location 'usgovvirginia' and API version '2024-04-03' for type 'hostpools/sessionhosts'. The supported api-versions are '2019-01-23-preview, 2019-09-24-preview, 2019-12-10-preview, 2020-09-21-preview, 2020-10-19-preview, 2020-11-02-preview, 2020-11-10-preview, 2021-01-14-preview, 2021-02-01-preview, 2021-03-09-preview, 2021-04-01-preview, 2021-05-13-preview, 2021-08-04-preview, 2021-09-03-preview, 2021-09-17-privatepreview, 2022-01-12-privatepreview, 2022-02-10-preview, 2022-04-01-preview, 2022-07-05-preview, 2022-08-09-privatepreview, 2022-09-01-privatepreview, 2022-10-14-preview, 2022-12-09-privatepreview, 2023-01-28-privatepreview, 2023-01-30-preview, 2023-03-03-privatepreview, 2023-03-21-privatepreview, 2023-03-30-privatepreview, 2023-04-06-preview, 2023-05-15-privatepreview, 2023-05-18-privatepreview, 2023-07-07-preview, 2023-10-04-preview, 2023-10-09-privatepreview, 2023-11-01-preview, 2023-11-29-privatepreview, 2024-01-16-preview, 2021-07-12, 2022-09-09, 2023-09-05'. The supported locations are 'usgovarizona, usgovvirginia'."
  }
}


DEBUG: ResponseCreated:
DEBUG: BeforeResponseDispatch:
Get-AzWvdSessionHost_List: No registered resource provider found for location 'usgovvirginia' and API version '2024-04-03' for type 'hostpools/sessionhosts'. The supported api-versions are '2019-01-23-preview, 2019-09-24-preview, 2019-12-10-preview, 2020-09-21-preview, 2020-10-19-preview, 2020-11-02-preview, 2020-11-10-preview, 2021-01-14-preview, 2021-02-01-preview, 2021-03-09-preview, 2021-04-01-preview, 2021-05-13-preview, 2021-08-04-preview, 2021-09-03-preview, 2021-09-17-privatepreview, 2022-01-12-privatepreview, 2022-02-10-preview, 2022-04-01-preview, 2022-07-05-preview, 2022-08-09-privatepreview, 2022-09-01-privatepreview, 2022-10-14-preview, 2022-12-09-privatepreview, 2023-01-28-privatepreview, 2023-01-30-preview, 2023-03-03-privatepreview, 2023-03-21-privatepreview, 2023-03-30-privatepreview, 2023-04-06-preview, 2023-05-15-privatepreview, 2023-05-18-privatepreview, 2023-07-07-preview, 2023-10-04-preview, 2023-10-09-privatepreview, 2023-11-01-preview, 2023-11-29-privatepreview, 2024-01-16-preview, 2021-07-12, 2022-09-09, 2023-09-05'. The supported locations are 'usgovarizona, usgovvirginia'.
DEBUG: [Finally]: Getting exception 'Microsoft.Azure.Commands.Common.Exceptions.AzPSCloudException: InternalException' from response
DEBUG: Finally:
DEBUG: CmdletAfterAPICall:
DEBUG: [CmdletProcessRecordAsyncEnd]: Finish HTTP process
DEBUG: CmdletProcessRecordAsyncEnd:
DEBUG: CmdletProcessRecordEnd:
DEBUG: AzureQoSEvent:  Module: Az.DesktopVirtualization:5.4.1; CommandName: Get-AzWvdSessionHost; PSVersion: 7.5.0; IsSuccess: False; Duration: 00:00:00.4905912; SanitizeDuration: 00:00:00; Exception: InternalException;

Is this a proper bug that I should report or just an issue with my workspace?

Share Improve this question asked Mar 12 at 19:03 theillientheillien 1,3894 gold badges22 silver badges36 bronze badges 1
  • You are probably getting HTTP error 404 Path not found. Your error message says "NotFound". Error 404 indicates the Route does not exist or you do not have permission to access the Route. – jdweng Commented Mar 12 at 21:56
Add a comment  | 

1 Answer 1

Reset to default 0

The error is saying that the specified API version 2024-04-03 is not available for desktop virtualization resource provider. Check the available versions and provide the right one to avoid the issues.

Also, check the PowerShell Gallery to find out the latest version releases of Az.Desktop Virtualisation module and also check if the PowerShell version is compatible with the Az module version.

I tried to use Get-AzWvdHostPool command in my environment with all the latest versions and it worked as shown below without any conflict.

Also, try specifying the Api version as 2024-11-01 along with the Get-AzResource in the below way.

Get-AzResource -ResourceType "Microsoft.DesktopVirtualization/hostpools" -ApiVersion "2024-11-01"

Try to clear the PowerShell console cache with Clear- Azcontextcommand as it clears all the accounts and logged in subscriptions. Now login again with the correct subscription and account details and try executing the command again.

You can also refer this MS Doc for Microsoft.Desktopvirtualization/Hostpools resource provider available API versions clearly.

Verify if you have the latest module version available by using below command.

Get-Module <Modulename> -ListAvailable

本文标签: powershellAzure Az module throwing an API error when runningStack Overflow