aks-engine icon indicating copy to clipboard operation
aks-engine copied to clipboard

aks engine tutorial deploy didn't work: can't open input file: az

Open realcom opened this issue 7 years ago • 22 comments

Kubernetes version: mac, brew installed aks-engine and azure-cli.

aks-engine version: v0.32.1 azure-cli: 2.0.60

What happened: When I follow the step described in tutorial, "aks-engine deploy" didn't work as I expected.

It showed this message aks-engine deploy --subscription-id 3ec0b1e5-8676-4855-bf51-a8b1092815b7
--auth-method cli
--dns-prefix contoso-apple
--resource-group contoso-apple
--location koreacentral
--api-model examples/kubernetes.json
--set servicePrincipalProfile.clientId="a9e0943a-b846-4a47-8859-*"
--set servicePrincipalProfile.secret="6551f548-6648-431e-86f7-
"

" failed to load apimodel: failed to get client: Invoking Azure CLI failed with the following error: /bin/zsh: can't open input file: az"

I didn't know this error caused by my wrong zsh setting or aks-engine bug.

realcom avatar Mar 15 '19 05:03 realcom

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it.

welcome[bot] avatar Mar 15 '19 05:03 welcome[bot]

can you run azure-cli commands locally? az --version for example

CecileRobertMichon avatar Mar 15 '19 18:03 CecileRobertMichon

I don't think this is an aks-engine bug (haven't seen this reported anywhere else), most likely the error is what it says it is: zsh can't run az (azure-cli).

CecileRobertMichon avatar Mar 15 '19 18:03 CecileRobertMichon

@CecileRobertMichon I got the same error. I use zsh and can run az --version

hieuhc avatar Apr 03 '19 13:04 hieuhc

weird...I use zsh too and I'm not seeing any errors. My guess is it has something to do with your az install. Where is yours located? Mine is in

which az                                                                                                                                                   
/usr/local/bin/az

CecileRobertMichon avatar Apr 03 '19 16:04 CecileRobertMichon

Mine is

which az 
/usr/bin/az

Maybe aks-engine command only looks for az in some pre-defined set of locations? az location is added to the $PATH on my machine so it can be invoked from terminal.

hieuhc avatar Apr 04 '19 07:04 hieuhc

I'm experiencing the same issue.

$ zsh --version
zsh 5.5.1 (x86_64-apple-darwin17.5.0)
$ which az
/Users/martinffx/bin/az
$ aks-engine version
Version: v0.33.3
GitCommit: 395ef242f
GitTreeState: clean

martinffx avatar Apr 04 '19 15:04 martinffx

So I found the place where this is failing... It's actually not part of the aks-engine code it's part of one of the vendor directories: https://github.com/Azure/aks-engine/blob/master/vendor/github.com/Azure/go-autorest/autorest/azure/cli/token.go#L121

FWIW, this config works for me:

 zsh --version && which az && az --version                                                                                                                   ✔  3799  18:42:00
zsh 5.6.2 (x86_64-apple-darwin17.7.0)
/usr/local/bin/az
azure-cli (2.0.49)

CecileRobertMichon avatar Apr 05 '19 01:04 CecileRobertMichon

I've tried to align my environment as close as possible with yours but I still getting the same issue.

$ zsh --version && which az && az --version                                                                                                                                                                                              
zsh 5.7.1 (x86_64-apple-darwin18.2.0)
/usr/local/bin/az
azure-cli                         2.0.61

martinffx avatar Apr 05 '19 06:04 martinffx

getting this on wsl ubuntu as well

itaysk avatar May 07 '19 11:05 itaysk

INFO[0000] new api model file has been generated during merge: /tmp/mergedApiModel144878442 DEBU[0000] Resolving tenantID for subscriptionID: *** Error: loading API model: failed to get client: Invoking Azure CLI failed with the following error:

No error is displayed. This should be investigated.

munishm avatar May 07 '19 13:05 munishm

In case you are running it inside the linux container and it errors out at Invoking CLI, the solution is to change the authentication method to client_secret rather than CLI

--auth-method client_secret

munishm avatar May 08 '19 10:05 munishm

Hi there... I had the same issue... resolved run the command with "sudo" ;)

cpunella avatar May 21 '19 15:05 cpunella

Running into the same problem here on latest aks-engine and azure cli -- using sudo aks-engine ... works, but is no permanent solution.

ahoereth avatar Jul 01 '19 12:07 ahoereth

@ahoereth are you using --auth-method client_secret as Munish pointed out?

CecileRobertMichon avatar Jul 01 '19 16:07 CecileRobertMichon

No, but I am also running locally on macos, not inside a docker container. The goal is to use cli as auth method and it worked previously. Works using sudo.

ahoereth avatar Jul 01 '19 16:07 ahoereth

In that case you should use --auth-method cli. The device auth-method which was previously default was deprecated a while ago and replaced by client-secret as default.

We still need to investigate why no error is returned before getting to this step if the auth doesn't work.

CecileRobertMichon avatar Jul 01 '19 16:07 CecileRobertMichon

I am using --auth-method cli -- same problem.

 aks-engine deploy --auth-method cli --subscription-id ... --resource-group ... --dns-prefix ... --location northeurope --debug --api-model aks.json --force-overwrite```

ahoereth avatar Jul 01 '19 16:07 ahoereth

And you are logged into az cli? I assume you ran az login before running aks-engine deploy?

CecileRobertMichon avatar Jul 01 '19 16:07 CecileRobertMichon

Jup, ran az login fine before running aks-engine deploy. If I use sudo aks-engine deploy instead it works. If I do not use sudo I get the error stated above: " failed to load apimodel: failed to get client: Invoking Azure CLI failed with the following error: /bin/zsh: can't open input file: az"

ahoereth avatar Jul 01 '19 16:07 ahoereth