Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.25k stars 3.84k forks source link

Get-AzComputeResourceSku cmdlet errors out when using "EdgeZone" parameter #24201

Closed viananth closed 1 month ago

viananth commented 8 months ago

Description

According to the documentation, Get-AzComputeResourceSku cmdlet supports "-EdgeZone" parameter. But when used it throws error.

PS C:\Users\viananth> Get-AzComputeResourceSku -location westus -edgezone losangeles Get-AzComputeResourceSku: The value 'losangeles' was provided for includeExtendedLocations; the value must be boolean. ErrorCode: InvalidParameters ErrorMessage: The value 'losangeles' was provided for includeExtendedLocations; the value must be boolean. ErrorTarget: StatusCode: 400 ReasonPhrase: Bad Request OperationID : a89762d0-9b75-49be-889e-80c504a85247

This behavior is not correct. If "edgezone" parameter is expecting a boolean input, the parameter should be a switch parameter (eg. "-inclueExtendedLocations". If "-edgezone" parameter is present, it should take an edgezone name and filter based on that name.

Issue script & Debug output

PS C:\Users\viananth> Get-AzComputeResourceSku -location westus -edgezone losangeles
DEBUG: 3:52:02 PM - GetAzureRmComputeResourceSku begin processing with ParameterSet 'DefaultParameter'.
DEBUG: 3:52:02 PM - using account id 'viananth@microsoft.com'...
DEBUG: 3:52:02 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: [Common.Authentication]: Authenticating using Account: 'viananth@microsoft.com', environment: 'AzureCloud', tenant: '72f988bf-86f1-41af-91ab-2d7cd011db47'
[Redacted...]
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: '72f988bf-86f1-41af-91ab-2d7cd011db47', UserId: 'viananth@microsoft.com'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/1d85fdce-f71c-4ecd-a06d-ea46effcccd0/providers/Microsoft.Compute/skus?api-version=2021-07-01&$filter=location eq %27westus%27&includeExtendedLocations=losangeles

Headers:
x-ms-client-request-id        : 1ff54bd7-c323-4f9e-b784-2796562beaf2
Accept-Language               : en-US

Body:

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
BadRequest

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
x-ms-failure-cause            : gateway
x-ms-ratelimit-remaining-subscription-reads: 11999
x-ms-request-id               : 39f8d872-5f48-4e6d-bf16-1d93e0c85a47
x-ms-correlation-request-id   : 39f8d872-5f48-4e6d-bf16-1d93e0c85a47
x-ms-routing-request-id       : WESTUS2:20240221T235203Z:39f8d872-5f48-4e6d-bf16-1d93e0c85a47
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
X-Cache                       : CONFIG_NOCACHE
X-MSEdge-Ref                  : Ref A: 128FD08E2B904E2AA082358D231E6AA0 Ref B: CO6AA3150218047 Ref C: 2024-02-21T23:52:02Z
Date                          : Wed, 21 Feb 2024 23:52:02 GMT

Body:
{
  "error": {
    "code": "InvalidParameters",
    "message": "The value 'losangeles' was provided for includeExtendedLocations; the value must be boolean."
  }
}

DEBUG: 3:52:03 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 3:52:03 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent:  Module: Az.Compute:7.1.1; CommandName: Get-AzComputeResourceSku; PSVersion: 7.2.18; IsSuccess: True; Duration: 00:00:00.3718206
DEBUG: 3:52:03 PM - [ConfigManager] Got [True] from [EnableDataCollection], Module = [], Cmdlet = [].
DEBUG: 3:52:03 PM - GetAzureRmComputeResourceSku end processing.
DEBUG: 3:52:03 PM - [ConfigManager] Got nothing from [DisableErrorRecordsPersistence], Module = [], Cmdlet = []. Returning default value [False].
Get-AzComputeResourceSku: The value 'losangeles' was provided for includeExtendedLocations; the value must be boolean.
ErrorCode: InvalidParameters
ErrorMessage: The value 'losangeles' was provided for includeExtendedLocations; the value must be boolean.
ErrorTarget:
StatusCode: 400
ReasonPhrase: Bad Request
OperationID : 39f8d872-5f48-4e6d-bf16-1d93e0c85a47
DEBUG: 3:52:03 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 3:52:03 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 3:52:03 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent:  Module: Az.Compute:7.1.1; CommandName: Get-AzComputeResourceSku; PSVersion: 7.2.18; IsSuccess: False; Duration: 00:00:00.3718206; Exception: The value 'losangeles' was provided for includeExtendedLocations; the value must be boolean.
ErrorCode: InvalidParameters
ErrorMessage: The value 'losangeles' was provided for includeExtendedLocations; the value must be boolean.
ErrorTarget:
StatusCode: 400
ReasonPhrase: Bad Request
OperationID : 39f8d872-5f48-4e6d-bf16-1d93e0c85a47;
DEBUG: 3:52:03 PM - GetAzureRmComputeResourceSku end processing.

Environment data

PS C:\Users\viananth> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.2.18
PSEdition                      Core
GitCommitId                    7.2.18
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

PS C:\Users\viananth> get-module az*

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.15.0                Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzConte…
Script     7.1.1                 Az.Compute                          {Add-AzImageDataDisk, Add-AzVhd, Add-AzVMAddition…

Error output

PS C:\Users\viananth> resolve-azerror
DEBUG: 3:54:26 PM - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 3:54:26 PM - using account id 'viananth@microsoft.com'...
DEBUG: 3:54:26 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].

   HistoryId: 3

RequestId      :
Message        : The value 'losangeles' was provided for includeExtendedLocations; the value must be boolean.
                 ErrorCode: InvalidParameters
                 ErrorMessage: The value 'losangeles' was provided for includeExtendedLocations; the value must be
                 boolean.
                 ErrorTarget:
                 StatusCode: 400
                 ReasonPhrase: Bad Request
                 OperationID : 39f8d872-5f48-4e6d-bf16-1d93e0c85a47
ServerMessage  :
ServerResponse :
RequestMessage :
InvocationInfo : {Get-AzComputeResourceSku}
Line           : Get-AzComputeResourceSku -location westus -edgezone losangeles
Position       : At line:1 char:1
                 + Get-AzComputeResourceSku -location westus -edgezone losangeles
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
StackTrace     :    at Microsoft.Azure.Commands.Compute.ComputeClientBaseCmdlet.ExecuteClientAction(Action action)
                    at Microsoft.Azure.Commands.Compute.Automation.GetAzureRmComputeResourceSku.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.<ExecuteSynchronously
                 OrAsJob>b__3_0(T c)
                    at
                 Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T
                 cmdlet, Action`1 executor)
                    at
                 Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T
                 cmdlet)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
HistoryId      : 3

   HistoryId: 1

RequestId      :
Message        : The value 'losangeles' was provided for includeExtendedLocations; the value must be boolean.
                 ErrorCode: InvalidParameters
                 ErrorMessage: The value 'losangeles' was provided for includeExtendedLocations; the value must be
                 boolean.
                 ErrorTarget:
                 StatusCode: 400
                 ReasonPhrase: Bad Request
                 OperationID : a89762d0-9b75-49be-889e-80c504a85247
ServerMessage  :
ServerResponse :
RequestMessage :
InvocationInfo : {Get-AzComputeResourceSku}
Line           : Get-AzComputeResourceSku -location westus -edgezone losangeles
Position       : At line:1 char:1
                 + Get-AzComputeResourceSku -location westus -edgezone losangeles
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
StackTrace     :    at Microsoft.Azure.Commands.Compute.ComputeClientBaseCmdlet.ExecuteClientAction(Action action)
                    at Microsoft.Azure.Commands.Compute.Automation.GetAzureRmComputeResourceSku.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.<ExecuteSynchronously
                 OrAsJob>b__3_0(T c)
                    at
                 Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T
                 cmdlet, Action`1 executor)
                    at
                 Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T
                 cmdlet)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
HistoryId      : 1

DEBUG: 3:54:26 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 3:54:26 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent:  Module: Az.Accounts:2.15.0; CommandName: Resolve-AzError; PSVersion: 7.2.18; IsSuccess: True; Duration: 00:00:00.0629705
DEBUG: 3:54:26 PM - [ConfigManager] Got [True] from [EnableDataCollection], Module = [], Cmdlet = [].
DEBUG: 3:54:26 PM - ResolveError end processing.
microsoft-github-policy-service[bot] commented 8 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Drewm3, @TravisCragg-MSFT, @nikhilpatel909, @sandeepraichura, @hilaryw29, @GabstaMSFT, @ramankumarlive, @ushnaarshadkhan.

TravisCragg-MSFT commented 8 months ago

@viananth Thank you for the feedback. I agree that this parameter is not succinct, and it is not possible to filter by a specific edge zone at this time.

We are in the process of revamping the SKU API, and it will give better options to query specific edge zones, search for specific VM Series, and filter results better. Using the -EdgeZone paramter will no longer be a best practice. We expect a preview of this new service to be out later this year.