Azure / Azure/azure-cli

Is there a way to read a YAML file from stdin when creating containers

Open
#20,293 3 comments 1 reaction 0 assignees View on GitHub
act-observability-squad Container Instances customer-reported Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Action

We use [envsubst](https://www.man7.org/linux/man-pages/man1/envsubst.1.html) to replace values in a YAML to allow us to reuse the template in multiple environments.

We would like to pipe the modified YAML into Azure CLI and use this as a stdin file (using `@-`):

```sh
envsubst < containers-template.yaml | az container create -g some-resource-group --file @-`
```

### Expected outcome

Creates a container using the modified YAML

### Actual outcome

Azure CLI tries to parse each line as a "YAML" file

```
No such file or directory: api-version: 2019-12-01
location: centralus
name: aci-name-of-container-group
<< shorten for brevity >>
```

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 2e5d1da7-7c4f-c9e6-e4b9-a30407675acf
* Version Independent ID: ba32e12d-8283-f980-e1d0-1ca2a75a5152
* Content: [az container](https://docs.microsoft.com/en-us/cli/azure/container?view=azure-cli-latest)
* Content Source: [latest/docs-ref-autogen/container.yml](https://github.com/MicrosoftDocs/azure-docs-cli/blob/master/latest/docs-ref-autogen/container.yml)
* Service: **container-service**
* GitHub Login: @rloutlaw
* Microsoft Alias: **routlaw**

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.