Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ protected override void OnProcessRecord()
ResourceTypeName = type.ResourceTypeName,
Locations = type.Locations,
ApiVersions = type.ApiVersions,
ZoneMappings = type.ZoneMappings
ZoneMappings = type.ZoneMappings,
DefaultApiVersion = type.DefaultApiVersion
}
},
ZoneMappings = type.ZoneMappings
Expand Down
4 changes: 4 additions & 0 deletions src/Resources/ResourceManager/ResourceManager.format.ps1xml
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,10 @@
<Label>ApiVersions</Label>
<PropertyName>ApiVersions</PropertyName>
</ListItem>
<ListItem>
<Label>DefaultApiVersion</Label>
<PropertyName>DefaultApiVersion</PropertyName>
</ListItem>
</ListItems>
</ListEntry>
</ListEntries>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public static PSResourceProvider ToPSResourceProvider(this Provider provider)
ResourceTypeName = resourceType.ResourceType,
Locations = resourceType.Locations != null ? resourceType.Locations.ToArray() : null,
ApiVersions = resourceType.ApiVersions != null ? resourceType.ApiVersions.ToArray() : null,
DefaultApiVersion = resourceType.DefaultApiVersion
}).ToArray(),
};
}
Expand Down Expand Up @@ -214,7 +215,7 @@ public static string ConstructOutputTable(IDictionary<string, object> dictionary
dictionary.Keys.ForEach(k => maxNameLength = Math.Max(maxNameLength, k.Length + 2));

StringBuilder output = new StringBuilder();

if (dictionary.Count > 0)
{
string rowFormat = "{0, -" + maxNameLength + "} {1}\r\n";
Expand Down Expand Up @@ -266,7 +267,7 @@ public static string ConstructDeploymentVariableTable(Dictionary<string, Deploym

foreach (KeyValuePair<string, DeploymentVariable> pair in dictionary)
{
result.AppendFormat(rowFormat, pair.Key, pair.Value.Type,
result.AppendFormat(rowFormat, pair.Key, pair.Value.Type,
JsonConvert.SerializeObject(pair.Value.Value).Indent(maxNameLength + maxTypeLength + 4).Trim());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,10 @@ public class PSResourceProviderResourceType
/// Gets or sets the zone mappings that this resource supports.
/// </summary>
public Hashtable ZoneMappings { get; set; }

/// <summary>
/// Gets or sets the default api version for this resource.
/// </summary>
public string DefaultApiVersion { get; set; }
}
}
3 changes: 2 additions & 1 deletion src/Resources/Resources/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
-->

## Upcoming Release
* Added DefaultApiVersion to the returned properties of the `Get-AzResourceProvider` cmdlet's Resource Type array
* Added Diagnostics/Warnings to WhatIf/Validate results for deployments.
* Fixed bug unexpected type issue: [#26752]
* Added parameter `RequestedAccessTokenVersion` for `New-AzADApplication` and `Update-AzADApplication`
Expand Down Expand Up @@ -49,7 +50,7 @@
* `New-AzPolicyExemption`
* `Update-AzPolicyAssignment`
* `Update-AzPolicyExemption`
* Fixed bug deserializing property: `policyDefinitionReferenceId` [#25112]
* Fixed bug deserializing property: `policyDefinitionReferenceId` [#25112]
* Fixed overriding of Bicep parameters in Deployment cmdlets to support `SecureString` parameters.
* Added Test cmdlets for Deployment Stacks.

Expand Down
16 changes: 16 additions & 0 deletions src/Resources/Resources/help/Get-AzResourceProvider.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,22 @@ Locations : {West US, East US, North Europe, West Europe…}

This command Gets all the resource providers under "Microsoft.Compute" and "Microsoft.Network".

### Example 4: Get the default API version for a specific resource type

```powershell
$crp = Get-AzResourceProvider -ProviderNamespace "Microsoft.Compute"
$crp.ResourceTypes | Where-Object { $_.ResourceTypeName -eq "disks" }
```

```output
ResourceTypeName : disks
Locations : {Southeast Asia, East US 2, Central US, West Europe…}
ApiVersions : {2024-03-02, 2023-10-02, 2023-04-02, 2023-01-02…}
DefaultApiVersion : 2022-03-02
```

To get the default API version for a specific resource type, get the resource provider first then filter the resource type by name.

## PARAMETERS

### -ApiVersion
Expand Down
Loading