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

--set needs examples

Open pskelley55 opened this issue 6 years ago • 4 comments

In Windows - PowerShell In Linux - pwsh

Please provide CLI examples using "--set" for both Windows and Linux platforms. They're DIFFERENT! I spent hours just discovering on the Windows side that you MUST have a SPACE between "k2": and "v1" !!! Sheesh! I NEVER figured out Linux version of CLI !!! HELP!!!

Windows: az iot hub device-twin update --hub-name test --device-id 000680015ba1 --set properties.desired={"k1":{"k2": "v1", "k3": "value 2"}}

Linux: az iot hub device-twin update --hub-name test --device-id 000680015ba1 --set properties.desired={"k1":{"k2": "v1", "k3": "value 2"}}

<<< LINUX snip >>> PS /home/debuguser/s0-test> az iot hub device-twin update --hub-name sznacaiottest --device-id 000680015ba1 --set properties.desired={"k1":{"k2":"v1"}} ParserError: Line | 1 | … test --device-id 000680015ba1 --set properties.desired={"k1":{"k2":"v … | ~ | Unexpected token ':' in expression or statement.

PS /home/debuguser/s0-test> az iot hub device-twin update --hub-name sznacaiottest --device-id 000680015ba1 --set properties.desired={"k1":{"k2":"v1"}} az iot hub device-twin update: 'utputformat' is not a valid value for '--output'. See 'az iot hub device-twin update --help'. PS /home/debuguser/s0-test> <<< snip-end >>> [Enter feedback here]


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

pskelley55 avatar Jul 15 '20 17:07 pskelley55

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

ghost avatar Jul 15 '20 22:07 ghost

iot hub

yonzhan avatar Jul 15 '20 22:07 yonzhan

@Azure/azure-iot-cli-triage

yiyiguo avatar Sep 15 '20 21:09 yiyiguo

Sorry you've run into issues with the input format using update, we fully acknowledge your feedback.

Actually usage of --set for az iot hub device-twin update is now deprecated. You will want to use the --desired or --tags arguments. There are some examples available in the IoT extension reference but they are bash examples.

For powershell you will want to do something like this (taking one of the existing bash examples):

az iot hub device-twin update -n {iothub_name} -d {device_id} --desired "{\"conditions\":{\"temperature\":{\"warning\":70, \"critical\":100}}}"

Here is a guide that explains input differences (particularly when JSON is involved) https://docs.microsoft.com/en-us/cli/azure/use-cli-effectively?view=azure-cli-latest#quoting-issues

In an upcoming release we will add more examples for different environments.

digimaun avatar Sep 15 '20 22:09 digimaun