Azure / Azure/azure-cli

az container create with the option --environment-variables failing for a long list of environment-variables

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

Description

> ### `az feedback` auto-generates most of the information requested below, as of CLI version 2.0.62

**Describe the bug**
az container create with the option --environment-variables failing for a long list of environment-variables

**To Reproduce**
1. Create an Azure Container Registry
2. Create an Azure Container Instance from [1] with a long list of environment variables
I used **'ServiceBusSettings__Host=xxxxxxxxxxxxxxxx.canadaeast.azurecontainer.io' 'ServiceBusSettings__Username=xxxxx' 'MongoDbSettings__ConnectionString=mongodb://xxxxxxxxxxxxxxxxxxx.mongo.cosmos.azure.com:10255/?ssl=true&replicaSet=globaldb&retrywrites=false&maxIdleTimeMS=120000&appName=@xxxxxxxxxxxxxxxx@' 'MongoDbSettings__Username=xxxxxxxxxxxxxxxxxxxxxxx'**

In my command all acr credentials were supplied but when it failed the command would prompt me to enter acr username and password

**Expected behavior**
an azure container is created

**Environment summary**
Windows 10, PowerShell in VS Code, Azure CLI v. 2.25.0, Python 3.8 pip 21.1.1

**Additional context**
A workaround was to generate using az container create --file myfile.yaml

Here is the problematic command
az container create `
--resource-group "xxxxxxxxxxxxxxxxxxxxxxxxx" `
--name "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" `
--location "canadaeast" `
--dns-name-label "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" `
--image "xxxxxxxxxxxxxxxxx.azurecr.io/xxxxxxxxxxxxxxxxxxxxxxxx:latest" `
--os-type Linux `
--cpu 1 `
--memory 1 `
--ports 80 `
--protocol TCP `
--environment-variables 'ServiceBusSettings__Host=xxxxxxxxxxxxxxxxxxxxxxxx.canadaeast.azurecontainer.io' 'ServiceBusSettings__Username=xxxxxxxxxxxx' 'MongoDbSettings__ConnectionString=mongodb://xxxxxxxxxxxxxxxxxxx.mongo.cosmos.azure.com:10255/?ssl=true&replicaSet=globaldb&retrywrites=false&maxIdleTimeMS=120000&appName=@xxxxxxxxxxxxxxxxxxxxxxxxx@' 'MongoDbSettings__Username=xxxxxxxxxxxxxxxxxxxxxxxxxx' `
--secure-environment-variables 'ServiceBusSettings__Password=xxxxxxxxxx' 'MongoDbSettings__Password=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' `
--registry-login-server "xxxxxxxxxxxxxxxxxxxx.azurecr.io" `
--registry-username "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" `
--registry-password "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

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.