Azure / Azure/azure-cli

curl: command not found when using docker image >= 2.54.0 in an ARM deploymentScript w/ supportingScriptUris

Open
#29,000 15 comments 0 reactions 1 assignee Claimed by @bebound View on GitHub
Azure CLI Team customer-reported question
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

When using `"kind": "AzureCLI"` inside of a `Microsoft.Resources/deploymentScripts` inside an ARM deployment, the script fails when one or more `supportingScriptUris` are set.

This happens because when `supportingScriptUris` is set, the entrypoint script (`/mnt/azscripts/azscriptinput/DeploymentScript.sh`, provided by the deployment) attempts to retrieve these additional resources using cURL.

cURL was removed in 2.54.0, in this [commit](https://github.com/Azure/azure-cli/commit/5a4d0fb4789cb83f55bc3860e236c2f2b720e204), to remove build dependencies from the docker image.

As there seems to be no way to change the default entrypoint script in a `Microsoft.Resources/deploymentScripts`, this is now broken for any AZ CLI version >= 2.54.0

### Related command

`docker run -it mcr.microsoft.com/azure-cli:2.61.0 /bin/bash -c 'curl'`

### Errors

```
Uri: https://amastorageprodus.blob.core.windows.net/applicationdefinitions//artifacts/install.sh failed to download. Detail: /mnt/azscripts/azscriptinput/DeploymentScript.sh: line 93: curl: command not found
```

### Issue script & Debug output

Sample `Microsoft.Resources/deploymentScripts` definition:
```json
{
"type": "Microsoft.Resources/deploymentScripts",
"apiVersion": "2023-08-01",
"name": "test-script",
"location": "[parameters('location')]",
"kind": "AzureCLI",
"properties": {
"azCliVersion": "2.59.0",
"supportingScriptUris": [
"[uri(deployment().properties.templateLink.uri, 'artifacts/install.sh')]"
],
"scriptContent": "/bin/bash ./install.sh"
}
}
```

### Expected behavior

Using `supportingScriptUris` inside of a `Microsoft.Resources/deploymentScripts` ARM resource pulls the external artifacts.

### Environment Summary

docker image `mcr.microsoft.com/azure-cli` with tags >= 2.54.0

### Additional context

The only workaround I've found is to fall back to 2.53.0.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.