A perplexed software developer is presenting his laptop screen.

How to fix “NoRegisteredProviderFound” when trying to run any aks az cli commands

This post was most recently updated on April 4th, 2024.

5 min read.

This article explains how to fix an error “NoRegisteredProviderFound”, which is thrown by az cli’s aks commands when you’re trying to run pretty much any aks commands in PowerShell/Terminal.

Read on to join me on a journey to discover how a fresh install of the Azure CLI can simply randomly be broken!

Background

So here’s a weird one for y’all. Some time ago, a botched Windows Update caused me to try and fix my laptop by updating it to Windows 11. That didn’t work, and I actually ended up finally having to reinstall the whole machine, and was left with a fresh Windows 11 environment without any of the tools I need for my daily work.

Obviously, I had to install Azure CLI to get some work done – and the right way to approach something like this is to get the latest version from Microsoft.

The latest version at the time of writing was 2.57.0, so that’s what I installed, and got on with my daily life of administering stuff on Azure.

Problem

But therein was lying a problem that I was ready to stub my toe in: trying to run any AKS commands failed with an error I had never seen before.

In this particular case, I was trying to run this:

az aks get-credentials --resource-group contoso-WestEurope-Prod --name MyCluster --overwrite-existing

But that didn’t turn out so well – I got the following exception:

(NoRegisteredProviderFound) No registered resource provider found for location 'westeurope' and API version '2022-04-02-preview' for type 'managedClusters'. The supported api-versions are '2017-08-31, 2018-03-31, 2019-02-01, 2019-04-01, 2019-06-01, 2019-08-01, 2019-10-01, 2019-11-01, 2020-01-01, 2020-02-01, 2020-03-01, 2020-04-01, 2020-06-01, 2020-07-01, 2020-09-01, 2020-11-01, 2020-12-01, 2021-02-01, 2021-03-01, 2021-05-01, 2021-07-01, 2021-08-01, 2021-09-01, 2021-10-01, 2022-01-01, 2022-02-01, 2022-03-01, 2022-04-01, 2022-06-01, 2022-07-01, 2022-07-02-preview, 2022-08-01, 2022-08-02-preview, 2022-08-03-preview, 2022-09-01, 2022-09-02-preview, 2022-10-02-preview, 2022-11-01, 2022-11-02-preview, 2023-01-01, 2023-01-02-preview, 2023-02-01, 2023-02-02-preview, 2023-03-01, 2023-03-02-preview, 2023-04-01, 2023-04-02-preview, 2023-05-01, 2023-05-02-preview, 2023-06-01, 2023-06-02-preview, 2023-07-01, 2023-07-02-preview, 2023-08-01, 2023-08-02-preview, 2023-09-01, 2023-09-02-preview, 2023-10-01, 2023-10-02-preview, 2023-11-01, 2023-11-02-preview, 2024-01-01, 2024-01-02-preview'. The supported locations are 'australiacentral, australiacentral2, australiaeast, australiasoutheast, brazilsouth, brazilsoutheast, canadacentral, canadaeast, centralindia, centralus, eastasia, eastus, eastus2, francecentral, francesouth, germanynorth, germanywestcentral, israelcentral, italynorth, japaneast, japanwest, jioindiacentral, jioindiawest, koreacentral, koreasouth, northcentralus, northeurope, norwayeast, norwaywest, polandcentral, qatarcentral, southafricanorth, southafricawest, southcentralus, southindia, southeastasia, swedencentral, switzerlandnorth, switzerlandwest, uaecentral, uaenorth, uksouth, ukwest, westcentralus, westeurope, westus, westus2, westus3'.
Code: NoRegisteredProviderFound
Message: No registered resource provider found for location 'westeurope' and API version '2022-04-02-preview' for type 'managedClusters'. The supported api-versions are '2017-08-31, 2018-03-31, 2019-02-01, 2019-04-01, 2019-06-01, 2019-08-01, 2019-10-01, 2019-11-01, 2020-01-01, 2020-02-01, 2020-03-01, 2020-04-01, 2020-06-01, 2020-07-01, 2020-09-01, 2020-11-01, 2020-12-01, 2021-02-01, 2021-03-01, 2021-05-01, 2021-07-01, 2021-08-01, 2021-09-01, 2021-10-01, 2022-01-01, 2022-02-01, 2022-03-01, 2022-04-01, 2022-06-01, 2022-07-01, 2022-07-02-preview, 2022-08-01, 2022-08-02-preview, 2022-08-03-preview, 2022-09-01, 2022-09-02-preview, 2022-10-02-preview, 2022-11-01, 2022-11-02-preview, 2023-01-01, 2023-01-02-preview, 2023-02-01, 2023-02-02-preview, 2023-03-01, 2023-03-02-preview, 2023-04-01, 2023-04-02-preview, 2023-05-01, 2023-05-02-preview, 2023-06-01, 2023-06-02-preview, 2023-07-01, 2023-07-02-preview, 2023-08-01, 2023-08-02-preview, 2023-09-01, 2023-09-02-preview, 2023-10-01, 2023-10-02-preview, 2023-11-01, 2023-11-02-preview, 2024-01-01, 2024-01-02-preview'. The supported locations are 'australiacentral, australiacentral2, australiaeast, australiasoutheast, brazilsouth, brazilsoutheast, canadacentral, canadaeast, centralindia, centralus, eastasia, eastus, eastus2, francecentral, francesouth, germanynorth, germanywestcentral, israelcentral, italynorth, japaneast, japanwest, jioindiacentral, jioindiawest, koreacentral, koreasouth, northcentralus, northeurope, norwayeast, norwaywest, polandcentral, qatarcentral, southafricanorth, southafricawest, southcentralus, southindia, southeastasia, swedencentral, switzerlandnorth, switzerlandwest, uaecentral, uaenorth, uksouth, ukwest, westcentralus, westeurope, westus, westus2, westus3'.

And of course while the exception itself is very, very vocal and explicit, you might encounter variations of it with different locations and API versions. Let’s break this particular case down a little bit:

(NoRegisteredProviderFound) <- this is a the actual error but not the root cause. In the registered providers for your subscription, the particular one required by az cli for aks did not exist.

No registered resource provider found for location ‘westeurope’ <- okay, if this was a new region/location for my commands, maybe this was helpful. But it isn’t – I have provided plenty of clusters to this location before.

and API version ‘2022-04-02-preview’ for type ‘managedClusters’. <- this just solidifies it’s about AKS (‘managedClusters’), but the API version being a random, old preview of course is a huge indicator of something really weird having happened.

What gives?

Reason

Okay, so this is going to be incredibly specific to my case, but you’ll probably be able to extrapolate from my solution (which I’ll share a little bit further below), if you run into a similar issue in the future.

I figured the most likely culprit is going to be the aks-preview extension that provides az cli with AKS superpowers. I used to have a well-functioning setup, but I just had to update to Windows 11 and reinstall things like az cli with the latest ones I could get, so I was wondering if I had received some new and updated version of the toolset, and would do well to downgrade.

So I ran the following command to output versions of my az cli toolchain:

az version

Your output might look somewhat like this:

{
  "azure-cli": "2.57.0",
  "azure-cli-core": "2.57.0",
  "azure-cli-telemetry": "1.1.0",
  "extensions": {
    "aks-preview": "0.5.71"
  }
}

That didn’t seem right. At this point, I had a hunch that aks-preview would be outdated.

And it was.

Which is weird, since I had JUST installed the az cli itself – shouldn’t it come with reasonably recent extension versions??

Anyway – looking at the version history, we have plenty of newer versions available. And the default version of an extensions called “aks-preview” was about 3 years old.

So by default, you get an almost 2-year-old snapshot of what should be thought of as an unstable preview version of an extension at that point. OF COURSE it doesn’t work like it should!

git blame history for the changelog.md file for aks-preview az cli extension reveals I got a 2-3 years old version of the extension with my fresh install of az cli.
git blame history for the changelog.md file for aks-preview az cli extension reveals I got a 2-3 years old version of the extension with my fresh install of az cli.

Anyway – let’s fix it, shall we?

Solution

Long story short, since we know the aks-preview extension is probably outdated, and we can probably fix it by updating it.

You can do something like this, for example – note, how I don’t add the “–allow-preview” switch as I’d like to get the latest stable version of the extension:

az extension update -n "aks-preview"

Running az extension list again, we can see the new version of the extension:

[
  {
    "experimental": false,
    "extensionType": "whl",
    "name": "aks-preview",
    "path": "C:\Users\contosouser\.azure\cliextensions\aks-preview",
    "preview": true,
    "version": "2.0.0b2"
  }
]

…. Alright. So I’ve now got a beta-version of the extension? That doesn’t count as “preview”, then?

Anyway. Updating to a newer version (from the 3-year-old default) did fix the issue. So we’re good on that matter.

But I guess this was a useful learning experience on how rickety even a usually well-functioning and professionally maintained toolchain can be in reality 😁

mm
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments