crossplane-contrib / provider-azure

Crossplane Azure Provider
Apache License 2.0
93 stars 64 forks source link

Azure deployment: failed to get SPT from client credentials #351

Open bluedog13 opened 2 years ago

bluedog13 commented 2 years ago

What happened?

The "SYNCED" status is always "false" when I try to deploy a resource into Azure. I have the creds.json file and have generated the secret using creds.json file as well.

I am following the example provided here to deploy a resource in Azure.

I see the below error when i run the describe command on the resource

Status:
  Conditions:
    Last Transition Time:  2022-09-14T21:35:05Z
    Message:               connect failed: cannot get authorizer from client credentials config: failed to get SPT from client credentials: parameter 'activeDirectoryEndpoint' cannot be empty
    Reason:                ReconcileError
    Status:                False
    Type:                  Synced

How can we reproduce it?

Just by following the example here

What environment did it happen in?

Crossplane version: 1.9.1

Additional Details

The generated creds.json file is of the following format

{
  "appId": "[redacted]",
  "displayName": "azure-cli-2022-09-14-20-29-57",
  "password": "[redacted]",
  "tenant": "[redacted]"
}
bluedog13 commented 2 years ago

The below solved it. (the documentation is missing "--sdk-auth" in the command)

az ad sp create-for-rbac \
        --role Contributor \
        --scopes /subscriptions/[redacted] \
        --sdk-auth \
        > "creds.json"

As a word of caution going forward : "WARNING: Option '--sdk-auth' has been deprecated and will be removed in a future release."