azure-cli: Listing DNS entries fails, expecting 2023-07-01-preview API version to be present.

Describe the bug

When trying to list A records inside my public DNS zone, Azure CLI 2.50.0 fails with invalid API versions. Works as expected for CLI version 2.49.0. Issue seems related with https://github.com/Azure/azure-cli/commit/6e905f4f63592098abf0e09b492f2f305cf60210 as I see 2023-07-01-preview versions hardocded in some places.

Related command

$ az network dns record-set a list -g public-dns -z mypubliczone.com

Errors

(NoRegisteredProviderFound) No registered resource provider found for location 'global' and API version '2023-07-01-preview' for type 'dnszones/A'. The supported api-versions are '2015-05-04-preview, 2016-04-01, 2017-09-01, 2017-09-15-preview, 2017-10-01, 2018-03-01-preview, 2018-05-01'. The supported locations are ', global'.
Code: NoRegisteredProviderFound
Message: No registered resource provider found for location 'global' and API version '2023-07-01-preview' for type 'dnszones/A'. The supported api-versions are '2015-05-04-preview, 2016-04-01, 2017-09-01, 2017-09-15-preview, 2017-10-01, 2018-03-01-preview, 2018-05-01'. The supported locations are ', global'.

Issue script & Debug output

I have following available versions of the Microsoft.Network provider for dnszones/A resource type:

$ az provider show --namespace Microsoft.Network --query "resourceTypes[?resourceType=='dnszones/A']"
[
  {
    "aliases": null,
    "apiProfiles": null,
    "apiVersions": [
      "2018-05-01",
      "2018-03-01-preview",
      "2017-10-01",
      "2017-09-15-preview",
      "2017-09-01",
      "2016-04-01",
      "2015-05-04-preview"
    ],
    "capabilities": "None",
    "defaultApiVersion": "2018-05-01",
    "locationMappings": null,
    "locations": [
      "global"
    ],
    "properties": null,
    "resourceType": "dnszones/A",
    "zoneMappings": null
  }
]

I tried re-registering provider in the subscription hoping that 2023-07-01-preview will pop up, unfortunately no luck.

Expected behavior

I can list my DNS zone A entries

Environment Summary

azure-cli version 2.50.0

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 11
  • Comments: 20

Most upvoted comments

Running into the same issue in a large enterprise organisation using Azure DevOps pipelines. We use Azure agents, so we can therefore not use the workaround of downgrading the azure CLI version because it’s not in our control

fix this asap

We’ve encountered this issue kind of issue many times for various different CLI commands during the past 12 months (which is very disappointing). The following command works for downgrading the Azure CLI on ubuntu-20.04 Azure DevOps hosted agent:

- task: PowerShell@2
  displayName: 'Revert to az cli version 2.49.0'
  inputs:
    targetType: 'inline'
    pwsh: true
    script: |
      pip install -Iv azure-cli==2.49.0 --extra-index-url https://azurecliprod.blob.core.windows.net/edge

Running into this same issue today on Azure Devops release pipeline using a windows-2019 Azure Pipelines agent. Worked flawless daily before today.

Confirmed this command is failing for me also:

az network dns record-set list --resource-group recovery-non-prod --zone-name eph.reco.optum.com

With the error:

(NoRegisteredProviderFound) No registered resource provider found for location ‘global’ and API version ‘2023-07-01-preview’ for type ‘dnszones/recordsets’. The supported api-versions are ‘2015-05-04-preview, 2016-04-01, 2017-09-01, 2017-09-15-preview, 2017-10-01, 2018-03-01-preview, 2018-05-01’. The supported locations are ‘, global’. Code: NoRegisteredProviderFound Message: No registered resource provider found for location ‘global’ and API version ‘2023-07-01-preview’ for type ‘dnszones/recordsets’. The supported api-versions are ‘2015-05-04-preview, 2016-04-01, 2017-09-01, 2017-09-15-preview, 2017-10-01, 2018-03-01-preview, 2018-05-01’. The supported locations are ‘, global’.

It was working recently.

The biggest problem with the “downgrade” suggestion is this is impossible in Azure Cloud Shell.

Thank you for opening this issue, we will look into it.