-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
-j/--handle-extended-json-format does not work as expected for mutil-line string containing double quotes #12909
Comments
@zhoxing-ms , please help take a look. |
add to S169 |
add to S171 |
@galiacheng Hi, mutil-line is not supported in the semantics of JSON, so I understand that this issue is a feature request.
This error was obtained from the validationin of CLI. I tried to make CLI ignore the line feed in a string when validating JSON, but I still found some problems: the ARM template in CLI is designed to send to Service must be unmodified, and Service will add the line break as text to the multi-line string, such as:
The string |
Because the ARM template passed from CLI to Service can't be modified, so this problem can only be solved by Service, while on CLI side passes through the multi-line string when verifying.
So ask the Service team to see if this feature can be properly supported. |
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @armleads-azure. |
By the way, I find that the processing of mutil-line string in PowerShell is to add newline characters and then compress it into a single line before requesting a Service, Such as:
I think modifying the ARM template of customers before requesting a Service is not in line with the design and may destroys the customers's input to some extent. |
Multi-line may not be supported by vanilla JSON, but the ARM template documentation says that it is valid. I find the lack of multi-line support particularly frustrating when dealing with stored procs. |
I'd also make the argument that the value after the service processing is precisely what is expected. The fact that it won't work is specific to the field. It should be perfectly valid to have a variable whose value includes newlines. You just can't use that variable in a context where the new line wouldn't be allowed. For example, both of these values should be equivalent, and neither of them should work in a situation like this.
|
@dschmack Thank you for your feedback. I think this requires our service team to confirm whether automatically adding line breaks to the muti-line value is in line with the expected behavior. |
Referring to the comment from @zhoxing-ms in #15502
This is perfectly fine with me, as it gives clear error message what is wrong. And there is easy workaround for that:
And as I understand, there are other cases, where Service will change the content of the template (striping the comments, changing the lines etc.). But is it really stopping from fixing the bug? Maybe what could be done until Service is fixed is just to:
So the users will be aware and can consciously decide, if that's OK with them. I think that although it not solves fully the issue, it still improves the situation, especially that official documentation states that multiline strings and comments are supported. I understand that if I want to use multi-line strings in my deployments, I should use Powershell instead of azure-cli? If so, maybe azure-cli should detect such situation and refer user to the Powershell instead? |
@wiktorn Thank you for your advice. If the Service does not reply recently, we will consider this option.
In fact, the handling of this problem of PowerShell is not in line with our design, because they modify the content of the ARM template and then send it to the Service. The original intention of our design is not to modify the ARM template on the client side. |
@ifeoluwaokunoren Could you please help to triage this issue? |
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @armleads-azure. |
@apclouds @alex-frankel Could you please take a look at this issue? |
This issue was fixed by #15502 |
Hi experts,
I found if an ARM template contains multi-line string containing double quotes, the template deployment will fail, please help to check, thank you.
I would like to pass parameters that contains double quotes to shell script within virtual machine extension, please see variables executeCustomScriptArguments1. The template deployment failed. I deploy the template with az cli flag --handle-extended-json-format, az version is 2.2.0.
My template works if I change the mutil-line string to single line string.
Error:
The flag also works for cases listed in document, I can make sure my Az CLI supports --handle-extended-json-format.
Attach my template:
The text was updated successfully, but these errors were encountered: