Open ChristopherL-STCU opened 4 years ago
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @shenmuxiaosen, @avanigupta.
appconfig
Hi @ChristopherL-STCU, thanks for providing all the details. You're right, importing KeyVault references from a YAML file will not be possible with Azure CLI version 2.10.0 or later. This change was recently introduced in order to support proper import/export of key-values in App Configuration without losing their data type. So if you want to import settings with valid JSON values and a valid JSON content-type, you need to provide the settings in a JSON file. We currently do not support importing key-values from a YAML file with JSON content-type. For more information, see this how-to guide.
However, you can still import your KeyVault references from a JSON file. Key Vault references are already in JSON format and the reserved content-type for KeyVault references is also a valid JSON content-type. Your test file in JSON format should look like this:
{
"MySecret": {
"uri": "https://my-key-vault.vault.azure.net/secrets/my-secret"
}
}
And this would be the CLI command for importing KeyVault references:
az appconfig kv import -s file --path test.json --format json -n STCU-App-Config --content-type "application/vnd.microsoft.appconfig.keyvaultref+json;charset=utf-8"
Let me know if that helps!
Thank you @avanigupta. I will move our App Configuration files from YAML to JSON.
@ChristopherL-STCU Apologies for the late reply. I hope your issue is addressed. This github thread is open for quite sometime. Could you please let us know if you need any further assistance on this ? Awaiting your reply.
Thanks @navba-MSFT. From @avanigupta comment my understanding is that YAML import was deprecated. So the issue remains but my understanding is it is expected and that there are no plans to support YAML functionality. If this is correct then it seems this issue can be closed. But if YAML deprecation was a mistake and this functionality is intended then this issue can remain open to track it.
Hi @ChristopherL-STCU, this issue occurred because we don't support importing key-values from a YAML file with JSON content-type. If you still want this feature, feel free to open a new issue in https://github.com/Azure/AppConfiguration/issues repo and we will get this prioritized.
@navba-MSFT, this issue can be closed now.
When I exported from az app config using the UI, it produced this key vault reference:
MySecret:
uri: 'https://my-vault.vault.azure.net/secrets/MySecret'
This looks like an exact conversion from @avanigupta's example of the reference using the json file format. I'll bet this works fine for importing.
While secret refs do export that way, they do not import correctly.
Describe the bug
I see in the release notes there was recently the breaking change "Support settings with JSON content type" for AppConfig and I suspect this is what is impacting me.
Command Name
az appconfig kv import
Errors:
To Reproduce:
Steps to reproduce the behavior.
test.yml
with content such as: MySecret: '{"uri":"https://my-key-vault.vault.azure.net/secrets/my-secret"}'az appconfig kv import -s file --path test.yml --format yaml -n STCU-App-Config --content-type "application/vnd.microsoft.appconfig.keyvaultref+json;charset=utf-8"
Expected Behavior
Previously this would import the new property, now the above error occurs. If I change the content type by excluding
+json
or changing it to something else then the property is created but it is not a Key Vault reference. Is it possible to import a new Key Vault reference property within a YAML file in version 2.10.1 of the CLI?Environment Summary
Additional Context