Issue with azure-ad plugin returning 401 error during CloudQuery usage

Hi all,

I have been trying to use the azure-ad plugin. It looks like it is broken. I get the following error:

2024-03-15T06:40:04Z INF Loading spec(s) args=["/conf/cloudquery_postgres_azure.yml","/conf/cloudquery_azure_ad.yml"] module=cli
Error: failed to get plugin url for source year-of-the-nimbus/azure-ad@v1.0.3: unexpected status code 401

azure-ad.yml is what is provided on the plugin page:

kind: source
spec:
  # Source spec section
  name: "azure-ad"
  path: "year-of-the-nimbus/azure-ad"
  registry: "cloudquery"
  version: "v1.0.2"
  destinations: ["postgresql"]
  tables: ["azure_ad_users"]
  spec:
    # Optional parameters
    # concurrency: 50000

Is this a known issue? Any help is appreciated.

Hi @caring-turkey, which CLI version are you using?

I was able to use this configuration:

kind: source
spec:
  name: "azure-ad"
  path: "year-of-the-nimbus/azure-ad"
  registry: "cloudquery"
  version: "v1.0.3"
  destinations: ["postgresql"]
  tables: ["azure_ad_users"]
---
kind: destination
spec:
  name: "postgresql"
  path: "cloudquery/postgresql"
  registry: "cloudquery"
  version: "v7.3.5"
  spec:
    connection_string: "postgresql://postgres:pass@localhost:5432/postgres?sslmode=disable"
cloudquery plugin install nimbus.yml

Loading spec(s) from nimbus.yml
Downloading https://storage.googleapis.com/cq-cloud-releases/year-of-the-nimbus/source/azure-ad/v1.0.3/darwin_arm64
Downloading 100% |██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| (27/27 MB, 20 MB/s)        
Downloading https://storage.googleapis.com/cq-cloud-releases/cloudquery/destination/postgresql/v7.3.5/darwin_arm64
Downloading 100% |██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| (11/11 MB, 12 MB/s)  

I’m trying to use the azure-ad community plugin. I recommend updating to the latest CLI version and trying again. Another option is to cloudquery logout and cloudquery login again; maybe you have an expired token (or create an API token from your team settings via https://cloud.cloudquery.io/.

@erez, thank you for the response. I used the above configuration and it worked. I think I specified an incorrect API key, and the error message is misleading.
I was traveling, so couldn’t respond sooner.
The standard Azure plugin seems to support accepting OIDC tokens, but the AD plugin doesn’t seem to support it. Do we know when it will be supported?

Hi @caring-turkey,

Azure AD is a community plugin, so I recommend trying to contact the author here. If you don’t manage to get a response, we can try too.