Closed jsandquist closed 6 months ago
Thank you for reporting! It indeed looks like something's changed with the output from Get-AzResourceProvider cmdlet. We'll investigate.
I've done some digging with the product group and it turns out this behavior has been around since day one 😄. We've always just picked the first option in the list, which explains the current behavior. To make sure we're not missing out on resources with only preview API versions, we're planning to sort preview and GA API versions into separate arrays. This way, we'll only use the preview version if a GA version isn't available. What do you think about this approach?
Thanks for investigating! Seems like a really good approach. Personally, I was kind of confused as to why this was default behavior where the -Pre
switch would fill the need to include preview versions (I thought).
Thanks for investigating! Seems like a really good approach. Personally, I was kind of confused as to why this was default behavior where the
-Pre
switch would fill the need to include preview versions (I thought).
That's a reasonable guess 😄. But here's an interesting bit: many Az.PowerShell cmdlets, include the -Pre
parameter to 'consider preview API versions for the API call.' Essentially, this means that when you're running a cmdlet, it's equipped to handle the underlying REST call using these preview versions of the API.
Describe the bug
AzOps versions 2.3.0 and 2.3.1
Since a day or two the 'pull' pipeline decided to update all apiVersions in all files more or less, some of the them with preview status. Something must have changed with regards to the output from
Get-AzResourceProvider -ListAvailable
?Do we need to filter or sort the returned api versions perhaps? Any other idea would be most welcome?
I found #422 and related #425 from two years back.
Below is an example for an ordinary resource group and what we see.
Steps to reproduce
Connect-AzAccount ...
(Get-AzResourceProvider -ListAvailable).ResourceTypes | Where-Object { $_.ResourceTypeName -eq "resourceGroups" } | Select-Object -ExpandProperty ApiVersions
to partly mimic the code at
https://github.com/Azure/AzOps/blob/d34b87fda2dcf195253ce84689abb7c71ec0c371/src/functions/Initialize-AzOpsEnvironment.ps1#L106
and
https://github.com/Azure/AzOps/blob/d34b87fda2dcf195253ce84689abb7c71ec0c371/src/internal/functions/ConvertTo-AzOpsState.ps1#L225
Screenshots