azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

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

Open bruschke opened this issue 1 year ago • 3 comments

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 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

bruschke avatar Jun 27 '24 19:06 bruschke

Thank you for opening this issue, we will look into it.

yonzhan avatar Jun 27 '24 19:06 yonzhan

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @RandalliLama, @schaabs, @jlichwa.

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @AzureAppServiceCLI, @antcp.

the same issue is for import from app service to app config:

az appconfig kv import --name myAppConfig --source appservice --appservice-account /subscriptions/11111111111111/resourceGroups/myrg/providers/Microsoft.Web/sites/mywebapp --label webAppsettings --prefix PROD: --auth-mode login --subscription 1111111111111111111

error message:

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

Any news about when this might be fixed?

ciprianglg avatar Nov 06 '24 12:11 ciprianglg

I'm having the same error, this is the command I'm running: az appconfig kv export --name ${appconfig} --destination appservice --appservice-account ${appservice} --label ppd --key BOT:* --prefix BOT: --export-as-reference false --skip-features

joalcava avatar Feb 12 '25 17:02 joalcava