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:
Summary:
The documentation is generally cross-platform, focusing on the Azure Portal and Azure CLI, both of which are available on Windows and Linux. However, there are repeated PowerShell-specific tips for escaping double quotes, which are only relevant to Windows users. There are no Linux- or Bash-specific examples or tips, and no mention of Linux tools or shell patterns.
Recommendations:
- Add Bash/Linux shell equivalents for escaping quotes in CLI commands, e.g., show how to use single quotes or proper escaping in Bash.
- Include a note or example for Linux/macOS users on how to handle JSON strings in CLI commands.
- Balance PowerShell-specific tips with Bash-specific tips to ensure parity.
- Explicitly state that the Azure CLI commands work cross-platform and provide any OS-specific caveats where relevant.
Create pull request
Flagged Code Snippets
>[!TIP]
>If you're using PowerShell, add a backslash `\` to escape any double quotes. For example: `--tags '{\"country\":\"US\"}'`.
---
## Query for device twins
IoT Hub exposes the device twins for your IoT hub as a document collection called **devices**. You can query devices based on their device twin values.
This section describes how to run twin queries in the Azure portal and Azure CLI. To learn how to write twin queries, see [Queries for IoT Hub device and module twins](./query-twins.md).
### [Azure portal](#tab/portal)
1. In the [Azure portal](https://portal.azure.com), navigate to your IoT hub.
1. In your IoT hub, select **Devices** from the **Device management** section of the navigation menu.
1. You can either use a filter or a query to find devices based on their device twin details:
* **Find devices using a filter**:
1. Finding devices using a filter is the default view in the Azure portal. If you don't see these fields, select **Find devices using a filter**.
1. Select **Add filter**, and then select **Device tag** as the filter type from the drop-down menu.
1. Enter the desired tag name and value, select **Apply** to retrieve the list of devices that matches the criteria.
:::image type="content" source="./media/manage-device-twins/filter-device-twin-tags.png" alt-text="Screenshot of filtering devices with tags.":::
* **Find devices using a query**:
1. Select **Find devices using a query**.
1. Enter your query into the text box, then select **Run query**.
:::image type="content" source="./media/manage-device-twins/run-query.png" alt-text="Screenshot that shows using the device query filter in the Azure portal.":::
### [Azure CLI](#tab/cli)
Use the [az iot hub query](/cli/azure/iot/hub#az-iot-hub-query) command to return device information based on device twin or module twin queries.