Azure CLI - Execute command "az login" fails with "Command failed: az login --identity /bin/sh: 1: az: not found"

Describe the problem/error/question

I am trying to use Azure CLI to upload a file in Azure Storage container, from an N8N instance deployed on an Azure VM.
I’ve installed Azure CLI myself on the Linux Azure VM, as per Install the Azure CLI on Linux | Microsoft Learn

If I SSH into the Linux Azure VM, I can use Azure CLI commands:
~$ az login --identity
[
{
“environmentName”: “AzureCloud”,
“homeTenantId”: “<>”,
“id”: “<>”,
“isDefault”: true,
“managedByTenants”: ,
“name”: “<>”,
“state”: “Enabled”,
“tenantId”: “<>”,
“user”: {
“assignedIdentityInfo”: “MSI”,
“name”: “systemAssignedIdentity”,
“type”: “servicePrincipal”
}
}
]

From an “Execute Command” node, however, the same command fails with the exception “Command failed: az login --identity /bin/sh: 1: az: not found”

What is the error message (if any)?

{
“errorMessage”: “Command failed: az login --identity\n/bin/sh: 1: az: not found\n”,
“errorDetails”: {},
“n8nDetails”: {
“nodeName”: “Upload to Azure Storage1”,
“nodeType”: “n8n-nodes-base.executeCommand”,
“nodeVersion”: 1,
“itemIndex”: 0,
“time”: “23/07/2024, 01:02:27”,
“n8nVersion”: “1.50.1 (Self Hosted)”,
“binaryDataMode”: “default”,
“stackTrace”: [
“NodeOperationError: Command failed: az login --identity”,
“/bin/sh: 1: az: not found”,
“”,
" at Object.execute (/app/code/node_modules/n8n-nodes-base/nodes/ExecuteCommand/ExecuteCommand.node.ts:101:12)“,
" at processTicksAndRejections (node:internal/process/task_queues:95:5)”,
" at Workflow.runNode (/app/code/node_modules/n8n-workflow/src/Workflow.ts:1378:8)“,
" at /app/code/node_modules/n8n-core/src/WorkflowExecute.ts:1072:27”,
" at /app/code/node_modules/n8n-core/src/WorkflowExecute.ts:1775:11"
]
}
}

Please share your workflow

Share the output returned by the last node

N/A

Information on your n8n setup

  • n8n version: 1.50.1
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): I don’t know
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Cloudron on Azure Linux VM
  • Operating system: Ubuntu 2204

Hey @andreid,

That looks like the command is not installed for the users shell, Can you try something like /usr/bin/az login --identify and see if that works instead.

Don’t forget our SSH connections are non-interactive as well which some applications don’t like.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.