Iot Hub Resource - List By Subscription

Get all the IoT hubs in a subscription
Get all the IoT hubs in a subscription.

GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs?api-version=2018-04-01

URI Parameters

Name In Required Type Description
subscriptionId
path True
  • string

The subscription identifier.

api-version
query True
  • string

The version of the API.

Responses

Name Type Description
200 OK

This is a synchronous operation. The body contains a JSON-serialized array of the metadata from all the IoT hubs in the subscription.

Other Status Codes

DefaultErrorResponse

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

IotHubResource_ListBySubscription

Sample Request

GET https://management.azure.com/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/providers/Microsoft.Devices/IotHubs?api-version=2018-04-01

Sample Response

{
  "value": [
    {
      "id": "/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/testHub",
      "name": "testHub",
      "type": "Microsoft.Devices/IotHubs",
      "location": "centraluseuap",
      "tags": {},
      "etag": "AAAAAAFD6M4=",
      "properties": {
        "operationsMonitoringProperties": {
          "events": {
            "None": "None",
            "Connections": "None",
            "DeviceTelemetry": "None",
            "C2DCommands": "None",
            "DeviceIdentityOperations": "None",
            "FileUploadOperations": "None",
            "Routes": "None"
          }
        },
        "state": "Active",
        "provisioningState": "Succeeded",
        "ipFilterRules": [],
        "hostName": "iot-dps-cit-hub-1.azure-devices.net",
        "eventHubEndpoints": {
          "events": {
            "retentionTimeInDays": 1,
            "partitionCount": 2,
            "partitionIds": [
              "0",
              "1"
            ],
            "path": "iot-dps-cit-hub-1",
            "endpoint": "sb://iothub-ns-iot-dps-ci-245306-76aca8e13b.servicebus.windows.net/"
          },
          "operationsMonitoringEvents": {
            "retentionTimeInDays": 1,
            "partitionCount": 2,
            "partitionIds": [
              "0",
              "1"
            ],
            "path": "iot-dps-cit-hub-1-operationmonitoring",
            "endpoint": "sb://iothub-ns-iot-dps-ci-245306-76aca8e13b.servicebus.windows.net/"
          }
        },
        "routing": {
          "endpoints": {
            "serviceBusQueues": [],
            "serviceBusTopics": [],
            "eventHubs": [],
            "storageContainers": []
          },
          "routes": [],
          "fallbackRoute": {
            "name": "$fallback",
            "source": "DeviceMessages",
            "condition": "true",
            "endpointNames": [
              "events"
            ],
            "isEnabled": true
          }
        },
        "storageEndpoints": {
          "$default": {
            "sasTtlAsIso8601": "PT1H",
            "connectionString": "",
            "containerName": ""
          }
        },
        "messagingEndpoints": {
          "fileNotifications": {
            "lockDurationAsIso8601": "PT1M",
            "ttlAsIso8601": "PT1H",
            "maxDeliveryCount": 10
          }
        },
        "enableFileUploadNotifications": false,
        "cloudToDevice": {
          "maxDeliveryCount": 10,
          "defaultTtlAsIso8601": "PT1H",
          "feedback": {
            "lockDurationAsIso8601": "PT1M",
            "ttlAsIso8601": "PT1H",
            "maxDeliveryCount": 10
          }
        },
        "features": "None"
      },
      "sku": {
        "name": "S1",
        "tier": "Standard",
        "capacity": 1
      }
    }
  ]
}

Definitions

AccessRights

The permissions assigned to the shared access policy.

Capabilities

The capabilities and features enabled for the IoT hub.

CloudToDeviceProperties

The IoT hub cloud-to-device messaging properties.

ErrorDetails

Error details.

EventHubProperties

The properties of the provisioned Event Hub-compatible endpoint used by the IoT hub.

FallbackRouteProperties

The properties of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint.

FeedbackProperties

The properties of the feedback queue for cloud-to-device messages.

IotHubDescription

The description of the IoT hub.

IotHubDescriptionListResult

The JSON-serialized array of IotHubDescription objects with a next link.

IotHubProperties

The properties of an IoT hub.

IotHubSku

The name of the SKU.

IotHubSkuInfo

Information about the SKU of the IoT hub.

IotHubSkuTier

The billing tier for the IoT hub.

IpFilterActionType

The desired action for requests captured by this rule.

IpFilterRule

The IP filter rules for the IoT hub.

MessagingEndpointProperties

The properties of the messaging endpoints used by this IoT hub.

OperationsMonitoringProperties

The operations monitoring properties for the IoT hub. The possible keys to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods.

RouteProperties

The properties of a routing rule that your IoT hub uses to route messages to endpoints.

RoutingEndpoints

The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs.

RoutingEventHubProperties

The properties related to an event hub endpoint.

RoutingProperties

The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging

RoutingServiceBusQueueEndpointProperties

The properties related to service bus queue endpoint types.

RoutingServiceBusTopicEndpointProperties

The properties related to service bus topic endpoint types.

RoutingSource

The source that the routing rule is to be applied to, such as DeviceMessages.

RoutingStorageContainerProperties

The properties related to a storage container endpoint.

SharedAccessSignatureAuthorizationRule

The properties of an IoT hub shared access policy.

StorageEndpointProperties

The properties of the Azure Storage endpoint for file upload.

AccessRights

The permissions assigned to the shared access policy.

Name Type Description
DeviceConnect
  • string
RegistryRead
  • string
RegistryRead, DeviceConnect
  • string
RegistryRead, RegistryWrite
  • string
RegistryRead, RegistryWrite, DeviceConnect
  • string
RegistryRead, RegistryWrite, ServiceConnect
  • string
RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect
  • string
RegistryRead, ServiceConnect
  • string
RegistryRead, ServiceConnect, DeviceConnect
  • string
RegistryWrite
  • string
RegistryWrite, DeviceConnect
  • string
RegistryWrite, ServiceConnect
  • string
RegistryWrite, ServiceConnect, DeviceConnect
  • string
ServiceConnect
  • string
ServiceConnect, DeviceConnect
  • string

Capabilities

The capabilities and features enabled for the IoT hub.

Name Type Description
DeviceManagement
  • string
None
  • string

CloudToDeviceProperties

The IoT hub cloud-to-device messaging properties.

Name Type Description
defaultTtlAsIso8601
  • string

The default time to live for cloud-to-device messages in the device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages.

feedback

The properties of the feedback queue for cloud-to-device messages.

maxDeliveryCount
  • integer

The max delivery count for cloud-to-device messages in the device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages.

ErrorDetails

Error details.

Name Type Description
code
  • string

The error code.

details
  • string

The error details.

httpStatusCode
  • string

The HTTP status code.

message
  • string

The error message.

EventHubProperties

The properties of the provisioned Event Hub-compatible endpoint used by the IoT hub.

Name Type Description
endpoint
  • string

The Event Hub-compatible endpoint.

partitionCount
  • integer

The number of partitions for receiving device-to-cloud messages in the Event Hub-compatible endpoint. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages.

partitionIds
  • string[]

The partition ids in the Event Hub-compatible endpoint.

path
  • string

The Event Hub-compatible name.

retentionTimeInDays
  • integer

The retention time for device-to-cloud messages in days. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages

FallbackRouteProperties

The properties of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint.

Name Type Description
condition
  • string

The condition which is evaluated in order to apply the fallback route. If the condition is not provided it will evaluate to true by default. For grammar, See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language

endpointNames
  • string[]

The list of endpoints to which the messages that satisfy the condition are routed to. Currently only 1 endpoint is allowed.

isEnabled
  • boolean

Used to specify whether the fallback route is enabled.

name
  • string

The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique.

source

The source to which the routing rule is to be applied to. For example, DeviceMessages

FeedbackProperties

The properties of the feedback queue for cloud-to-device messages.

Name Type Description
lockDurationAsIso8601
  • string

The lock duration for the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages.

maxDeliveryCount
  • integer

The number of times the IoT hub attempts to deliver a message on the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages.

ttlAsIso8601
  • string

The period of time for which a message is available to consume before it is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages.

IotHubDescription

The description of the IoT hub.

Name Type Description
etag
  • string

The Etag field is not required. If it is provided in the response body, it must also be provided as a header per the normal ETag convention.

id
  • string

The resource identifier.

location
  • string

The resource location.

name
  • string

The resource name.

properties

IotHub properties

sku

IotHub SKU info

tags
  • object

The resource tags.

type
  • string

The resource type.

IotHubDescriptionListResult

The JSON-serialized array of IotHubDescription objects with a next link.

Name Type Description
nextLink
  • string

The next link.

value

The array of IotHubDescription objects.

IotHubProperties

The properties of an IoT hub.

Name Type Description
authorizationPolicies

The shared access policies you can use to secure a connection to the IoT hub.

cloudToDevice

The IoT hub cloud-to-device messaging properties.

comments
  • string

IoT hub comments.

enableFileUploadNotifications
  • boolean

If True, file upload notifications are enabled.

eventHubEndpoints

The Event Hub-compatible endpoint properties. The possible keys to this dictionary are events and operationsMonitoringEvents. Both of these keys have to be present in the dictionary while making create or update calls for the IoT hub.

features

The capabilities and features enabled for the IoT hub.

hostName
  • string

The name of the host.

ipFilterRules

The IP filter rules.

messagingEndpoints

The messaging endpoint properties for the file upload notification queue.

operationsMonitoringProperties

The operations monitoring properties for the IoT hub. The possible keys to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods.

provisioningState
  • string

The provisioning state.

routing

The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging

state
  • string

The hub state.

storageEndpoints

The list of Azure Storage endpoints where you can upload files. Currently you can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one storage account causes an error to be thrown. Not specifying a value for this property when the enableFileUploadNotifications property is set to True, causes an error to be thrown.

IotHubSku

The name of the SKU.

Name Type Description
B1
  • string
B2
  • string
B3
  • string
F1
  • string
S1
  • string
S2
  • string
S3
  • string

IotHubSkuInfo

Information about the SKU of the IoT hub.

Name Type Description
capacity
  • integer

The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits.

name

The name of the SKU.

tier

The billing tier for the IoT hub.

IotHubSkuTier

The billing tier for the IoT hub.

Name Type Description
Basic
  • string
Free
  • string
Standard
  • string

IpFilterActionType

The desired action for requests captured by this rule.

Name Type Description
Accept
  • string
Reject
  • string

IpFilterRule

The IP filter rules for the IoT hub.

Name Type Description
action

The desired action for requests captured by this rule.

filterName
  • string

The name of the IP filter rule.

ipMask
  • string

A string that contains the IP address range in CIDR notation for the rule.

MessagingEndpointProperties

The properties of the messaging endpoints used by this IoT hub.

Name Type Description
lockDurationAsIso8601
  • string

The lock duration. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload.

maxDeliveryCount
  • integer

The number of times the IoT hub attempts to deliver a message. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload.

ttlAsIso8601
  • string

The period of time for which a message is available to consume before it is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload.

OperationsMonitoringProperties

The operations monitoring properties for the IoT hub. The possible keys to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods.

Name Type Description
events
  • object

RouteProperties

The properties of a routing rule that your IoT hub uses to route messages to endpoints.

Name Type Description
condition
  • string

The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language

endpointNames
  • string[]

The list of endpoints to which messages that satisfy the condition are routed. Currently only one endpoint is allowed.

isEnabled
  • boolean

Used to specify whether a route is enabled.

name
  • string

The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique.

source

The source that the routing rule is to be applied to, such as DeviceMessages.

RoutingEndpoints

The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs.

Name Type Description
eventHubs

The list of Event Hubs endpoints that IoT hub routes messages to, based on the routing rules. This list does not include the built-in Event Hubs endpoint.

serviceBusQueues

The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules.

serviceBusTopics

The list of Service Bus topic endpoints that the IoT hub routes the messages to, based on the routing rules.

storageContainers

The list of storage container endpoints that IoT hub routes messages to, based on the routing rules.

RoutingEventHubProperties

The properties related to an event hub endpoint.

Name Type Description
connectionString
  • string

The connection string of the event hub endpoint.

name
  • string

The name that identifies this endpoint. The name can only include alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: events, operationsMonitoringEvents, fileNotifications, $default. Endpoint names must be unique across endpoint types.

resourceGroup
  • string

The name of the resource group of the event hub endpoint.

subscriptionId
  • string

The subscription identifier of the event hub endpoint.

RoutingProperties

The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging

Name Type Description
endpoints

The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs.

fallbackRoute

The properties of the route that is used as a fall-back route when none of the conditions specified in the 'routes' section are met. This is an optional parameter. When this property is not set, the messages which do not meet any of the conditions specified in the 'routes' section get routed to the built-in eventhub endpoint.

routes

The list of user-provided routing rules that the IoT hub uses to route messages to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and a maximum of 5 routing rules are allowed for free hubs.

RoutingServiceBusQueueEndpointProperties

The properties related to service bus queue endpoint types.

Name Type Description
connectionString
  • string

The connection string of the service bus queue endpoint.

name
  • string

The name that identifies this endpoint. The name can only include alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: events, operationsMonitoringEvents, fileNotifications, $default. Endpoint names must be unique across endpoint types. The name need not be the same as the actual queue name.

resourceGroup
  • string

The name of the resource group of the service bus queue endpoint.

subscriptionId
  • string

The subscription identifier of the service bus queue endpoint.

RoutingServiceBusTopicEndpointProperties

The properties related to service bus topic endpoint types.

Name Type Description
connectionString
  • string

The connection string of the service bus topic endpoint.

name
  • string

The name that identifies this endpoint. The name can only include alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: events, operationsMonitoringEvents, fileNotifications, $default. Endpoint names must be unique across endpoint types. The name need not be the same as the actual topic name.

resourceGroup
  • string

The name of the resource group of the service bus topic endpoint.

subscriptionId
  • string

The subscription identifier of the service bus topic endpoint.

RoutingSource

The source that the routing rule is to be applied to, such as DeviceMessages.

Name Type Description
DeviceJobLifecycleEvents
  • string
DeviceLifecycleEvents
  • string
DeviceMessages
  • string
Invalid
  • string
TwinChangeEvents
  • string

RoutingStorageContainerProperties

The properties related to a storage container endpoint.

Name Type Description
batchFrequencyInSeconds
  • integer

Time interval at which blobs are written to storage. Value should be between 60 and 720 seconds. Default value is 300 seconds.

connectionString
  • string

The connection string of the storage account.

containerName
  • string

The name of storage container in the storage account.

encoding
  • string

Encoding that is used to serialize messages to blobs. Supported values are 'avro' and 'avroDeflate'. Default value is 'avro'.

fileNameFormat
  • string

File name format for the blob. Default format is {iothub}/{partition}/{YYYY}/{MM}/{DD}/{HH}/{mm}. All parameters are mandatory but can be reordered.

maxChunkSizeInBytes
  • integer

Maximum number of bytes for each blob written to storage. Value should be between 10485760(10MB) and 524288000(500MB). Default value is 314572800(300MB).

name
  • string

The name that identifies this endpoint. The name can only include alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: events, operationsMonitoringEvents, fileNotifications, $default. Endpoint names must be unique across endpoint types.

resourceGroup
  • string

The name of the resource group of the storage account.

subscriptionId
  • string

The subscription identifier of the storage account.

SharedAccessSignatureAuthorizationRule

The properties of an IoT hub shared access policy.

Name Type Description
keyName
  • string

The name of the shared access policy.

primaryKey
  • string

The primary key.

rights

The permissions assigned to the shared access policy.

secondaryKey
  • string

The secondary key.

StorageEndpointProperties

The properties of the Azure Storage endpoint for file upload.

Name Type Description
connectionString
  • string

The connection string for the Azure Storage account to which files are uploaded.

containerName
  • string

The name of the root container where you upload files. The container need not exist but should be creatable using the connectionString specified.

sasTtlAsIso8601
  • string

The period of time for which the SAS URI generated by IoT Hub for file upload is valid. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options.