This command restores the dependencies on first run, and then executes the program.
* If no error occurs, the program prints: "Service client created - ready to go".
* Since there isn't yet any error handling in this project, if there are any issues, you see an exception thrown by the code.
[!INCLUDE [Azure Digital Twins: DefaultAzureCredential known issue note](includes/digital-twins-defaultazurecredential-note.md)]
### Upload a model
Azure Digital Twins has no intrinsic domain vocabulary. You use *models* to define the types of elements in your environment that you can represent in Azure Digital Twins. [Models](concepts-models.md) are similar to classes in object-oriented programming languages; they provide user-defined templates for [digital twins](concepts-twins-graph.md) to follow and instantiate later. They're written in a JSON-like language called *Digital Twins Definition Language (DTDL)*.
The first step in creating an Azure Digital Twins solution is defining at least one model in a DTDL file.
In the directory where you created your project, create a new .json file called *SampleModel.json*. Paste in the following file body:
:::code language="json" source="~/digital-twins-docs-samples/models/SampleModel.json":::
> [!TIP]
> If you're using Visual Studio for this tutorial, you might want to select the newly created JSON file and set the **Copy to Output Directory** property in the Property inspector to **Copy if Newer** or **Copy Always**. This property value enables Visual Studio to find the JSON file with the default path when you run the program with F5 during the rest of the tutorial.
> [!TIP]
> You can check model documents to make sure the DTDL is valid using the [DTDLParser library](https://www.nuget.org/packages/DTDLParser). For more about using this library, see [Parse and validate models](how-to-parse-models.md).
Next, add some more code to *Program.cs* to upload the model you created into your Azure Digital Twins instance.
First, add a few `using` statements to the top of the file:
:::code language="csharp" source="~/digital-twins-docs-samples/sdks/csharp/fullClientApp.cs" id="Model_dependencies":::
Next, prepare to use the asynchronous methods in the C# service SDK, by changing the `Main` method signature to allow for async execution.
:::code language="csharp" source="~/digital-twins-docs-samples/sdks/csharp/fullClientApp.cs" id="Async_signature":::
> [!NOTE]
> Using `async` isn't strictly required, as the SDK also provides synchronous versions of all calls. This tutorial practices using `async`.
Next comes the first bit of code that interacts with the Azure Digital Twins service. This code loads the DTDL file you created from your disk, and then uploads it to your Azure Digital Twins service instance.
Paste in the following code under the authorization code you added earlier.
:::code language="csharp" source="~/digital-twins-docs-samples/sdks/csharp/fullClientApp_excerpt_model.cs" id="ClientExcerptModel":::
In your command window, run the program with this command: