Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get-AzResourceProvider does not return defaultApiVersion #26486

Open
efloresgil opened this issue Oct 25, 2024 · 1 comment
Open

Get-AzResourceProvider does not return defaultApiVersion #26486

efloresgil opened this issue Oct 25, 2024 · 1 comment
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported needs-triage This is a new issue that needs to be triaged to the appropriate team.

Comments

@efloresgil
Copy link

efloresgil commented Oct 25, 2024

Description

Description

The Get-AzResourceProvider cmdlet does not make the defaultApiVersion part of the response available in the resulting PsObject

The API itself does return the defaultApiVersion, but the command itself does not:

(Get-AzResourceProvider -Debug -ProviderNamespace "Microsoft.Compute").ResourceTypes[0].PsObject.Properties

Details

It appears the GetAzureProviderCmdlet class method OnProcessRecord does not load that particular part of the response:

new PSResourceProviderResourceType
{
ResourceTypeName = type.ResourceTypeName,
Locations = type.Locations,
ApiVersions = type.ApiVersions,
ZoneMappings = type.ZoneMappings
}

The PSResourceProviderResourceType class itself does not include this property yet.

public class PSResourceProviderResourceType
{
/// <summary>
/// Gets or sets the name of the resource type.
/// </summary>
public string ResourceTypeName { get; set; }
/// <summary>
/// Gets or sets the locations this resource is available in.
/// </summary>
public string[] Locations { get; set; }
/// <summary>
/// Gets or sets the api versions that this resource is supported in.
/// </summary>
public string[] ApiVersions { get; set; }
/// <summary>
/// Gets or sets the zone mappings that this resource supports.
/// </summary>
public Hashtable ZoneMappings { get; set; }
}

However, the ProviderResourceType class used to deserialize the API response does include it already:

[Newtonsoft.Json.JsonProperty(PropertyName = "defaultApiVersion")]
public string DefaultApiVersion {get; private set; }

Issue script & Debug output

You can confirm this behavior by running the following command and comparing the returned properties to the debug API response

(Get-AzResourceProvider -debug -ProviderNamespace "Microsoft.Compute").ResourceTypes[0].PsObject.Properties

Environment data

Name Value
---- -----
PSVersion 7.4.6
PSEdition Core
GitCommitId 7.4.6
OS Microsoft Windows 10.0.26100
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Module versions

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

Error output

N/A

@efloresgil efloresgil added bug This issue requires a change to an existing behavior in the product in order to be resolved. needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Oct 25, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported needs-triage This is a new issue that needs to be triaged to the appropriate team. and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Oct 25, 2024
@efloresgil
Copy link
Author

Proposed #26542 to address this. Awaiting review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported needs-triage This is a new issue that needs to be triaged to the appropriate team.
Projects
None yet
Development

No branches or pull requests

1 participant