Closed juliamuiruri4 closed 1 month ago
@pierceboggan - Just to bring this to your attention.
@juliamuiruri4 When using Azure CLI, you need to be aware of how your scripting language uses quotation marks and escapes characters. You can refer Quoting differences between scripting languages for more details.
Here're some suggestions for your scenario:
@<file>
convention to read JSON content from a file and bypass the shell's interpretation mechanisms.--debug
parameter to your command to inspect the actual parameter value received by Azure CLI. Then update the JSON parameter value to ensure Azure CLI gets the correct value. The document shared above provides some tips for you to fix the parameter value.Thanks @blackchoey - I got it to work on bash.
Cool! I will close this issue as you can run the command successfully. Feel free to contact me if you have further questions.
Describe the bug
I'm trying to create metadata, and even after correctly formatting the JSON for my --schema, I keep getting the same validation error.
Steps
I have a resource group called - contoso I created a new apic instance called contoso-apis-new
I try using the command below to create metadata, but I'm stuck on this error.
az apic metadata create -g contoso -n contoso-apis-new --metadata-name apiApprover --schema '{"type":"string","title":"APIApprover"}' --assignments '[{entity:api,required:true,deprecated:false},{entity:environment,required:true,deprecated:false}]'
Related command
az apic metadata create -g contoso -n contoso-apis-new --metadata-name apiApprover --schema '{"type":"string","title":"APIApprover"}' --assignments '[{entity:api,required:true,deprecated:false},{entity:environment,required:true,deprecated:false}]'
Errors
(ValidationError) Invalid metadata schema: invalid JSON detected. Please check for any syntax errors or missing brackets, commas, or quotes. Code: ValidationError Message: Invalid metadata schema: invalid JSON detected. Please check for any syntax errors or missing brackets, commas, or quotes.
Issue script & Debug output
Expected behavior
No error
Environment Summary
azure-cli 2.62.0
core 2.62.0 telemetry 1.1.0
Extensions: apic-extension 1.0.0+d26e680
Dependencies: msal 1.28.1 azure-mgmt-resource 23.1.1
Additional context
No response