This page contains Windows bias

About This Page

This page is part of the Azure documentation. It contains code examples and configuration instructions for working with Azure services.

Bias Analysis

Bias Types:
⚠️ windows_first
⚠️ missing_linux_example
⚠️ windows_tools
⚠️ powershell_heavy
Summary:
The documentation demonstrates a clear Windows bias: it assumes a Windows development environment by default, provides detailed steps and tooling instructions for Windows (e.g., Visual Studio, .NET Core SDK, Simulator.exe), and omits or relegates Linux/macOS instructions to external links. There are no explicit Linux or macOS command-line examples, and Windows-specific tools and patterns (like Visual Studio, Simulator.exe, and Windows command prompts) are referenced throughout, often without Linux equivalents or alternatives.
Recommendations:
  • Provide explicit Linux and macOS instructions and examples alongside Windows steps, not just as external links.
  • Include Linux/macOS command-line examples (e.g., using bash, make, gcc, or cross-platform build tools) wherever Windows commands or tools are shown.
  • Mention and demonstrate Linux-compatible TPM simulators and how to run them (e.g., using tpm2-software or other open-source TPM simulators).
  • Offer guidance for installing dependencies and building/running samples on Linux/macOS (e.g., using gcc/clang, CMake, Maven, npm, etc. on those platforms).
  • Avoid assuming Visual Studio or Windows-specific tools are required; clarify when cross-platform alternatives are available.
  • Where possible, use cross-platform language and tools (e.g., 'terminal' instead of 'command prompt', 'editor of your choice' instead of 'Visual Studio').
  • Ensure all code snippets and instructions are tested and validated on Linux/macOS as well as Windows.
GitHub Create pull request

Scan History

Date Scan ID Status Bias Status
2025-09-15 00:00 #112 completed ✅ Clean
2025-08-17 00:01 #83 in_progress ✅ Clean
2025-07-13 21:37 #48 completed ❌ Biased
2025-07-12 23:44 #41 in_progress ❌ Biased
2025-07-09 13:09 #3 cancelled ✅ Clean
2025-07-08 04:23 #2 cancelled ❌ Biased

Flagged Code Snippets

3. Save the file. 4. Use the following commands to build the project, navigate to the target folder, and execute the created .jar file (replace `{version}`with your version of Java):
::: zone-end ::: zone pivot="programming-language-csharp" 1. Open a Git CMD or Git Bash command-line environment. 2. Clone the [Azure IoT SDK for C#](https://github.com/Azure/azure-iot-sdk-csharp) GitHub repository using the following command:
::: zone-end ::: zone pivot="programming-language-nodejs" 1. Open a Git CMD or Git Bash command-line environment. 2. Clone the [azure-utpm-c](https://github.com/Azure/azure-utpm-c) GitHub repository using the following command:
> [!NOTE] > There are some known issues to installing the above packages. To resolve these issues, run `npm install --global --production windows-build-tools` using a command prompt in **Run as administrator** mode, run `SET VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140` after replacing the path with your installed version, and then rerun the above installation commands. > 5. Install all required packages running the following command at your command prompt in the **registerdevice** folder:
::: zone-end ::: zone pivot="programming-language-ansi-c, programming-language-csharp, programming-language-java" <a id="simulatetpm"></a> ## Read cryptographic keys from the TPM device ::: zone-end ::: zone pivot="programming-language-ansi-c, programming-language-java" In this section, you'll build and execute a sample that reads the endorsement key and registration ID from the TPM simulator you left running, and is still listening over ports 2321 and 2322. These values will be used for device enrollment with your Device Provisioning Service instance. ::: zone-end ::: zone pivot="programming-language-ansi-c" 1. Launch Visual Studio. 2. Open the solution generated in the *cmake* folder named `azure_iot_sdks.sln`. 3. On the Visual Studio menu, select **Build** > **Build Solution** to build all projects in the solution. 4. In Visual Studio's *Solution Explorer* window, navigate to the **Provision\_Tools** folder. Right-click the **tpm_device_provision** project and select **Set as Startup Project**. 5. On the Visual Studio menu, select **Debug** > **Start without debugging** to run the solution. The app reads and displays a **_Registration ID_** and an **_Endorsement key_**. Note or copy these values. These will be used in the next section for device enrollment. ::: zone-end ::: zone pivot="programming-language-java" 1. Sign in to the Azure portal, select the **All resources** button on the left-hand menu and open your Device Provisioning Service. Note your _ID Scope_ and _Provisioning Service Global Endpoint_. ![Screenshot of Device Provisioning Service overview page in the Azure portal.](./media/quick-create-simulated-device-tpm/copy-id-scope-and-global-device-endpoint.png) 2. Edit `src/main/java/samples/com/microsoft/azure/sdk/iot/ProvisioningTpmSample.java` to include your _ID Scope_ and _Provisioning Service Global Endpoint_ as noted before.
>[!TIP] >If `cmake` does not find your C++ compiler, you may get build errors while running the above command. If that happens, try running the command in the [Visual Studio command prompt](/dotnet/framework/tools/developer-command-prompt-for-vs). 2. When the build succeeds, the last few output lines look similar to the following output:
11. Run the sample. 12. The output window displays the **_Endorsement key_** and the **_Registration ID_** needed for device enrollment. Copy these values. ::: zone-end ::: zone pivot="programming-language-java" 1. Run the [TPM](/windows/device-security/tpm/trusted-platform-module-overview) simulator to be the [HSM](https://azure.microsoft.com/blog/azure-iot-supports-new-security-hardware-to-strengthen-iot-security/) for the simulated device. 2. Select **Allow Access**. The simulator listens over a socket on ports 2321 and 2322. Don't close this command window; you need to keep this simulator running until the end of this quickstart guide.
![TPM Simulator](./media/quick-create-simulated-device-tpm/simulator.png) 3. Open a second command prompt. 4. In the second command prompt, navigate to the root folder and build the sample dependencies.
::: zone-end ::: zone pivot="programming-language-csharp, programming-language-ansi-c, programming-language-nodejs, programming-language-java" <a id="portalenrollment"></a> ## Create a device enrollment entry ::: zone-end ::: zone pivot="programming-language-ansi-c, programming-language-nodejs, programming-language-java" <!-- INCLUDE --> [!INCLUDE [iot-dps-individual-enrollment-tpm.md](../../includes/iot-dps-individual-enrollment-tpm.md)] ::: zone-end ::: zone pivot="programming-language-csharp" The C# TPM sample for this quickstart doesn't provide a registration ID. When prompted to add one for the individual enrollment, provide your own value. <!-- INCLUDE --> [!INCLUDE [iot-dps-individual-enrollment-tpm.md](../../includes/iot-dps-individual-enrollment-tpm.md)] ::: zone-end ::: zone pivot="programming-language-csharp, programming-language-ansi-c, programming-language-nodejs, programming-language-java" ## Register the device In this section, you'll configure sample code to use the [Advanced Message Queuing Protocol (AMQP)](https://wikipedia.org/wiki/Advanced_Message_Queuing_Protocol) to send the device's boot sequence to your Device Provisioning Service instance. This boot sequence causes the device to be registered to an IoT hub linked to the Device Provisioning Service instance. ::: zone-end ::: zone pivot="programming-language-ansi-c" <a id="firstbootsequence"></a> 1. In the Azure portal, select the **Overview** tab for your Device Provisioning Service. 2. Copy the **_ID Scope_** value. ![Screenshot of the ID Scope value in the Device Provisioning Service overview page from the portal.](./media/quick-create-simulated-device-tpm/extract-dps-endpoints.png) 3. In Visual Studio's *Solution Explorer* window, navigate to the **Provision\_Samples** folder. Expand the sample project named **prov\_dev\_client\_sample**. Expand **Source Files**, and open **prov\_dev\_client\_sample.c**. 4. Near the top of the file, find the `#define` statements for each device protocol as shown below. Make sure only `SAMPLE_AMQP` is uncommented. Currently, the [MQTT protocol isn't supported for TPM Individual Enrollment](https://github.com/Azure/azure-iot-sdk-c#provisioning-client-sdk).
7. Right-click the **prov\_dev\_client\_sample** project and select **Set as Startup Project**. 8. On the Visual Studio menu, select **Debug** > **Start without debugging** to run the solution. In the prompt to rebuild the project, select **Yes**, to rebuild the project before running. The following output is an example of the provisioning device client sample successfully booting up, and connecting to a Device Provisioning Service instance to get IoT hub information and registering: