-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
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:
azure-powershell/src/Resources/ResourceManager/Implementation/Providers/GetAzureProviderCmdlet.cs
Lines 84 to 90 in 4011e52
new PSResourceProviderResourceType | |
{ | |
ResourceTypeName = type.ResourceTypeName, | |
Locations = type.Locations, | |
ApiVersions = type.ApiVersions, | |
ZoneMappings = type.ZoneMappings | |
} |
The PSResourceProviderResourceType
class itself does not include this property yet.
Lines 21 to 42 in 4011e52
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:
azure-powershell/src/Resources/Resources.Management.Sdk/Generated/Models/ProviderResourceType.cs
Lines 113 to 114 in 4011e52
[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