-
Notifications
You must be signed in to change notification settings - Fork 3k
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
az rest
cannot parse json body
#9742
Comments
az rest
cannot parse body jsonaz rest
cannot parse json body
@yugangw-msft for comment. |
@konrad-jamrozik, please wrap the |
@yugangw-msft wrapping it in quotes was not enough. I also had to do:
i.e. replace all occurrences of This fixed the issue. Thank you, and thank you for the pointer to the tips! |
Closing. There is nothing further we can do |
az cli should add support for -InFile, so customers can simply give a valid Json as input, rather than having to do lot of work arounds. Something in similar lines as below Invoke-RestMethod -Method "PUT" -Headers $requestHeader -Uri $uri -InFile $replicationGroupConfigPath |
|
got it thanks |
This issue is tracked by #15529. |
Describe the bug
The
az rest
fails to parse json body, as seen here:with
where
"./dynamic_threshold_metric_alert_body.json"
is an example alert body taken from https://docs.microsoft.com/en-us/rest/api/monitor/metricalerts/createorupdate#create_or_update_a_dynamic_alert_rule_for_multiple_resourceswith slight modifications to match my subscription name, resource group name, metric name, etc.
however, this works:
i.e. it returns
200
and I can observe in Azure portal that the alert got created.To Reproduce
Run the scripts pasted above, but first set variables to appropriate values.
Expected behavior
Expected for the
az rest --method put
command creating an alert to return200
and create an alert in Azure Portal.Environment summary
azure-cli is
2.0.67
, downloaded via MSI.The file snippets come from PS1 on Windows, UTF-8 CRLF.
Additional context
Discovered while trying to work around #9640
I observed more strange json body parsing problems, like e.g. inability to handle line breaks, or properly parse json key value.
@tjprescott
The text was updated successfully, but these errors were encountered: