Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.26k stars 3.86k forks source link

API Version is not valid #26111

Open mdaguete opened 1 month ago

mdaguete commented 1 month ago

Description

Usign Get-AzResource -ResourceID {AKS_ID} throws an error instead of aks data.

Issue script & Debug output

Get-AzResource: API version '2024-08-02-preview' is not valid
StatusCode: 400
ReasonPhrase: Bad Request
OperationID : 748126d8-a0f4-49b7-8b73-e2de7675acb7

Environment data

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.4.5
PSEdition                      Core
GitCommitId                    7.4.5
OS                             Fedora Linux 40 (Workstation Edition)
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

Get-Module Az*                                                                                                                                                                                                                 

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     3.0.4                 Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script     7.4.0                 Az.Resources                        {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAssignment, Get-AzDeployment…}

Error output

DEBUG: 18:47:17 - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 18:47:17 - ResolveError begin processing with ParameterSet 'LastErrorParameterSet'.
DEBUG: 18:47:17 - using account id 'manuelda@inditex.com'...
DEBUG: 18:47:17 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 18:47:17 - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].

   HistoryId: 11

RequestId      :
Message        : API version '2024-08-02-preview' is not valid
                 StatusCode: 400
                 ReasonPhrase: Bad Request
                 OperationID : a8b86600-2129-4458-b299-7f2ed3fbd78d
ServerMessage  :
ServerResponse :
RequestMessage :
InvocationInfo : {Get-AzResource}
Line           :  Get-AzResource -ResourceId "xxXX"
Position       : At line:1 char:2
                 +  Get-AzResource -ResourceId " …
                 +  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
StackTrace     :    at Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.ResourceManagerCmdletBase.HandleException(ExceptionDispatchInfo capturedException)
                    at Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.ResourceManagerCmdletBase.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.<ExecuteSynchronouslyOrAsJob>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      : 11

DEBUG: 18:47:17 - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 18:47:17 - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent:  Module: Az.Accounts:3.0.4; CommandName: Resolve-AzError; PSVersion: 7.4.5; IsSuccess: True; Duration: 00:00:00.0206904; SanitizeDuration: 00:00:00.0099972
DEBUG: 18:47:17 - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 18:47:17 - ResolveError end processing.
mdaguete commented 1 month ago

Same as https://github.com/Azure/azure-cli/issues/29913

brechtvhb commented 1 month ago

Having the same problem when I try to update my cluster using devops (ARM).

qhowardonboard commented 1 month ago

This is happening for 'Microsoft.CognitiveServices/accounts' resources as well. The ApiVersion '2024-10-01' is not registered for ResourceType 'Microsoft.CognitiveServices/accounts'. Valid Api Versions are: '2016-02-01-preview' '2017-04-18' '2021-04-30' '2021-10-01' '2022-03-01' '2022-07-01' '2099-01-01' '2022-10-01' '2022-12-01' '2023-05-01' '2023-06-01-preview' '2023-10-01-preview' '2024-04-01-preview' '2024-06-01-preview'. StatusCode: 400 ReasonPhrase: Bad Request OperationID : 26b1bab8-1f2d-4983-9c95-e1434a032a31

MGrasdal commented 1 month ago

Can confirm the issue with Microsoft.CognitiveServices/accounts. This was working fine a while ago.

image

isra-fel commented 1 month ago

Reached out to AKS team and this was fixed this monday. Reported to Cognitive team as well.