Azure / Azure/azure-powershell
API Version is not valid
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 3d 14h
- Merged PRs (30d)
- 54
Description
### Description
Usign Get-AzResource -ResourceID {AKS_ID} throws an error instead of aks data.
### Issue script & Debug output
```PowerShell
Get-AzResource: API version '2024-08-02-preview' is not valid
StatusCode: 400
ReasonPhrase: Bad Request
OperationID : 748126d8-a0f4-49b7-8b73-e2de7675acb7
```
### Environment data
```PowerShell
$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
```PowerShell
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
```PowerShell
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.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.
```
Contributor guide
Research direction
Start by reproducing Get-AzResource -ResourceId {AKS_ID} with the reported Az.Accounts 3.0.4, Az.Resources 7.4.0, and PowerShell 7.4.5 environment, then trace the Az.Resources entry point that selects API versions for AKS resource IDs. Done means the command returns AKS data instead of the 2024-08-02-preview validation error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp, powershell
- Domain
- api, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 42/100