Skip to main content

resources

Creates, updates, deletes, gets or lists a resources resource.

Overview

Nameresources
TypeResource
Idazure.iot_hub.resources

Fields

The following fields are returned by SELECT queries:

The body contains all the non-security properties of the IoT hub. Security-related properties are set to null.

NameDatatypeDescription
idstringThe resource identifier.
namestringThe resource name. (pattern: ^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$)
etagstringThe 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.
identityobjectThe managed identities for the IotHub.
locationstringThe resource location.
propertiesobjectIotHub properties
skuobjectIotHub SKU info
systemDataobjectThe system meta data relating to this resource.
tagsobjectThe resource tags.
typestringThe resource type.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectsubscriptionId, resourceGroupName, resourceNameapi-versionGet the non-security related metadata of an IoT hub.
list_by_resource_groupselectsubscriptionId, resourceGroupNameapi-versionGet all the IoT hubs in a resource group.
list_by_subscriptionselectsubscriptionIdapi-versionGet all the IoT hubs in a subscription.
create_or_updateinsertsubscriptionId, resourceGroupName, resourceName, data__skuapi-version, If-MatchCreate or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to default, which may lead to unexpected behavior.
updateupdatesubscriptionId, resourceGroupName, resourceNameapi-versionUpdate an existing IoT Hub tags. to update other fields use the CreateOrUpdate method
deletedeletesubscriptionId, resourceGroupName, resourceNameapi-versionDelete an IoT hub.
check_name_availabilityexecsubscriptionId, nameapi-versionCheck if an IoT hub name is available.
test_all_routesexeciotHubName, subscriptionId, resourceGroupNameapi-versionTest all routes configured in this Iot Hub
test_routeexeciotHubName, subscriptionId, resourceGroupName, routeapi-versionTest the new route for this Iot Hub
export_devicesexecsubscriptionId, resourceGroupName, resourceName, exportBlobContainerUri, excludeKeysapi-versionExports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
import_devicesexecsubscriptionId, resourceGroupName, resourceName, inputBlobContainerUri, outputBlobContainerUriapi-versionImport, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
iotHubNamestringIotHub to be tested
resourceGroupNamestringThe name of the resource group that contains the IoT hub.
resourceNamestringThe name of the IoT hub.
subscriptionIdstringThe subscription identifier.
If-MatchstringETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub.
api-versionstringThe version of the API.

SELECT examples

Get the non-security related metadata of an IoT hub.

SELECT
id,
name,
etag,
identity,
location,
properties,
sku,
systemData,
tags,
type
FROM azure.iot_hub.resources
WHERE subscriptionId = '{{ subscriptionId }}' -- required
AND resourceGroupName = '{{ resourceGroupName }}' -- required
AND resourceName = '{{ resourceName }}' -- required
AND api-version = '{{ api-version }}'
;

INSERT examples

Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to default, which may lead to unexpected behavior.

INSERT INTO azure.iot_hub.resources (
data__etag,
data__properties,
data__sku,
data__identity,
data__location,
data__tags,
subscriptionId,
resourceGroupName,
resourceName,
api-version,
If-Match
)
SELECT
'{{ etag }}',
'{{ properties }}',
'{{ sku }}' /* required */,
'{{ identity }}',
'{{ location }}',
'{{ tags }}',
'{{ subscriptionId }}',
'{{ resourceGroupName }}',
'{{ resourceName }}',
'{{ api-version }}',
'{{ If-Match }}'
RETURNING
id,
name,
etag,
identity,
location,
properties,
sku,
systemData,
tags,
type
;

UPDATE examples

Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method

UPDATE azure.iot_hub.resources
SET
data__tags = '{{ tags }}'
WHERE
subscriptionId = '{{ subscriptionId }}' --required
AND resourceGroupName = '{{ resourceGroupName }}' --required
AND resourceName = '{{ resourceName }}' --required
AND api-version = '{{ api-version}}'
RETURNING
id,
name,
etag,
identity,
location,
properties,
sku,
systemData,
tags,
type;

DELETE examples

Delete an IoT hub.

DELETE FROM azure.iot_hub.resources
WHERE subscriptionId = '{{ subscriptionId }}' --required
AND resourceGroupName = '{{ resourceGroupName }}' --required
AND resourceName = '{{ resourceName }}' --required
AND api-version = '{{ api-version }}'
;

Lifecycle Methods

Check if an IoT hub name is available.

EXEC azure.iot_hub.resources.check_name_availability 
@subscriptionId='{{ subscriptionId }}' --required,
@api-version='{{ api-version }}'
@@json=
'{
"name": "{{ name }}"
}'
;