microsoft / microsoft/AzureTRE
AZ CLI in devcontainer is too tightly coupled to the host machine
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 235
- Forks
- 192
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 13
Description
The devcontainer mounts the entire ${HOME}/.azure folder to give access to the Azure configuration for the az cli. This means that the host machine cannot upgrade the version of the cli it uses without risking breaking the scripts in the devcontainer, which assume an older version.
Steps to reproduce
- Go back in time 8-9 months.
- Create a VM, install the
azcli and theAzureTREcode on it. - Build the devcontainer.
- Come back to the present, upgrade the
azcli on the host. - Attempt to upgrade the
AzureTREdeployment, it will fail because the cli version in the container is not compatible with the extension versions mounted from the host.
One fix that seems to work is:
- in
devcontainer.json, mount the${HOME}/.azureto a different location in the container, e.g./tmp/host-azure - then, in the
post-create.shscript:- create the
/home/vscode/.azurefolder in the container - copy the
azureProfile.jsonfrom/tmp/host-azureto/home/vscode/.azure - create
az.jsonandaz.sessin the containers'/home/vscode/.azurewith an empty json object ({}) - ensure
/home/vscode/.azurein the container is owned & writable by thevscodeuser
- create the
- run
az loginin the container before getting started with the TRE
This leaves the two az installations completely decoupled, at the price of having to log in explicitly, once, in the container.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with devcontainer.json and post-create.sh, then inspect how the host .azure directory and the container's /home/vscode/.azure are currently connected. Test the container after changing the mount and initialization flow, including az login, and confirm host CLI upgrades no longer affect the container's Azure CLI extensions or deployment scripts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cli, cloud, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100