Azure / Azure/azure-cli

"az appconfig kv export --destination appservice" produces "Failed to read key-values from appservice" when DOCKER_REGISTRY_SERVER_PASSWORD exists in app service

Open
#29,270 5 comments 3 reactions 2 assignees Assigned to @evelyn-ys View on GitHub
act-codegen-extensibility-squad App Configuration Auto-Assign customer-reported question Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

Found that I continued to receive "Failed to read key-values from appservice. 'NoneType' object has no attribute 'strip'" when trying to export my configuration values from App Configuration Service to my App Service. I was able to finally get around the issue by removing the DOCKER_REGISTRY_SERVER_PASSWORD environment variable from app service. My work around is to delete the variable, then run the export command, and then re-insert the variable (in my case I stored the value in a separate key vault in order to re-create it.)

### Related command

This is my command with my workaround logic:
# DELETE ENV VAR DOCKER_REGISTRY_SERVER_PASSWORD
az webapp config appsettings delete --name my-app-service --resource-group my-resource-group --setting-names DOCKER_REGISTRY_SERVER_PASSWORD --only-show-errors

# EXPORT CONFIG TO APP SERVICE
az appconfig kv export \
--auth-mode login \
--endpoint https://my-config.azconfig.io \
--destination appservice \
--appservice-account /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.Web/sites/my-app-service \
--label my-label \
--export-as-reference true \
--skip-features true \
--only-show-errors \
--yes

# PULL DOCKER_REGISTRY_SERVER_PASSWORD VALUE FROM KEY VAULT
docker_password=$(az keyvault secret show --vault-name my-vault --name docker-registry-server-password --query value -o tsv)

# RE-CREATE ENV VAR DOCKER_REGISTRY_SERVER_PASSWORD
az webapp config appsettings set --name my-app-service --resource-group my-resource-group --settings DOCKER_REGISTRY_SERVER_PASSWORD=$docker_password

### Errors

Failed to read key-values from appservice. 'NoneType' object has no attribute 'strip'

### Issue script & Debug output

N/A - See error message

### Expected behavior

az appconfig kv export --destination appservice can be run successfully even when the DOCKER_REGISTRY_SERVER_PASSWORD environment variable is present

### Environment Summary

azure-cli 2.61.0

core 2.61.0
telemetry 1.1.0

Extensions:
azure-devops 1.0.1

Dependencies:
msal 1.28.0
azure-mgmt-resource 23.1.1

Python location '/opt/az/bin/python3'
Extensions directory '/opt/az/azcliextensions'

Python (Linux) 3.11.8 (main, May [16](https://github.com/Landdox/holocron/actions/runs/9701249330/job/26774790613#step:4:17) 2024, 03:47:28) [GCC 11.4.0]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

### Additional context

_No response_

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.