Share via

Azure Digital Twin CLI error

Seiya Zelin Shen 72 Reputation points
2022-03-24T13:41:22.77+00:00

I have a question on the website

https://learn.microsoft.com/zh-cn/azure/digital-twins/how-to-ingest-iot-hub-data?tabs=cli

when I run the create model or create twin as cli, it shows the error as following:

186475-image.png

may I know how is the error ? the cli command is :

az dt twin create --dt-name <instance-name> --dtmi "dtmi:contosocom:DigitalTwins:Thermostat;1" --twin-id thermostat67 --properties '{"Temperature": 0.0,}'

az dt model create --dt-name <instance-name> --models '{ "@id": "dtmi:contosocom:DigitalTwins:Thermostat;1", "@type ": "Interface", "@Георгий Георгиевский ": "dtmi:dtdl:context;2", "contents": [ { "@type ": "Property", "name": "Temperature", "schema": "double" } ]}'

many thanks.

Azure Digital Twins
Azure Digital Twins

An Azure platform that is used to create digital representations of real-world things, places, business processes, and people.


Answer accepted by question author

QuantumCache 20,681 Reputation points Moderator
2022-03-31T20:09:50.957+00:00

Hello @Seiya Sum Thanks for reaching out on this forum!

Thanks to @AshokPeddakotla-MSFT for the repro and validating the documentation on cloud shell.

After working offline with you on this issue, here is the summary\outcome which details the solution.

when I run the create model or create twin as cli, it shows the error as following:
188924-image.png
----> unrecognized arguments: 60.6,}'

Fix\Workaround: When you create a twin with the CLI, depending on what type of command prompt you're using, you might have to escape the " characters

az dt twin create    
             --dt-name myADTsoutheastasia.api.sea.digitaltwins.azure.net   
             --dtmi "dtmi:contosocom1:DigitalTwins:Thermostat;1"   
             --twin-id thermostat67   
             --properties "{\"Temperature\": 60.6,}"  

Documentation: We are updating instructions on the documentation as well for this CLI command usage.

Repro of the issue on Windows OS CLI Desktop version:

188917-image.png

We really appreciate your contribution on helping other community members, customers and improving product experience!!!

Please comment in the below section for further help in this matter, happy to help!

----------

Please do let me know if you have any queries.
Thanks
Satish

------------------------------------------

  • Please don't forget to click on 'Accept Answer' button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
  • Want a reminder to come back and check responses? Here is how to subscribe to a notification
  • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.