resources
Creates, updates, deletes, gets or lists a resources
resource.
Overview
Name | resources |
Type | Resource |
Id | azure.iot_hub.resources |
Fields
The following fields are returned by SELECT
queries:
- get
- list_by_resource_group
- list_by_subscription
The body contains all the non-security properties of the IoT hub. Security-related properties are set to null.
Name | Datatype | Description |
---|---|---|
id | string | The resource identifier. |
name | string | The resource name. (pattern: ^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$ ) |
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. |
identity | object | The managed identities for the IotHub. |
location | string | The resource location. |
properties | object | IotHub properties |
sku | object | IotHub SKU info |
systemData | object | The system meta data relating to this resource. |
tags | object | The resource tags. |
type | string | The resource type. |
This is a synchronous operation. The body contains a JSON-serialized array of the metadata from all the IoT hubs in the resource group.
Name | Datatype | Description |
---|---|---|
id | string | The resource identifier. |
name | string | The resource name. (pattern: ^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$ ) |
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. |
identity | object | The managed identities for the IotHub. |
location | string | The resource location. |
properties | object | IotHub properties |
sku | object | IotHub SKU info |
systemData | object | The system meta data relating to this resource. |
tags | object | The resource tags. |
type | string | The resource type. |
This is a synchronous operation. The body contains a JSON-serialized array of the metadata from all the IoT hubs in the subscription.
Name | Datatype | Description |
---|---|---|
id | string | The resource identifier. |
name | string | The resource name. (pattern: ^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$ ) |
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. |
identity | object | The managed identities for the IotHub. |
location | string | The resource location. |
properties | object | IotHub properties |
sku | object | IotHub SKU info |
systemData | object | The system meta data relating to this resource. |
tags | object | The resource tags. |
type | string | The resource type. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | subscriptionId , resourceGroupName , resourceName | api-version | Get the non-security related metadata of an IoT hub. |
list_by_resource_group | select | subscriptionId , resourceGroupName | api-version | Get all the IoT hubs in a resource group. |
list_by_subscription | select | subscriptionId | api-version | Get all the IoT hubs in a subscription. |
create_or_update | insert | subscriptionId , resourceGroupName , resourceName , data__sku | api-version , If-Match | 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. |
update | update | subscriptionId , resourceGroupName , resourceName | api-version | Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method |
delete | delete | subscriptionId , resourceGroupName , resourceName | api-version | Delete an IoT hub. |
check_name_availability | exec | subscriptionId , name | api-version | Check if an IoT hub name is available. |
test_all_routes | exec | iotHubName , subscriptionId , resourceGroupName | api-version | Test all routes configured in this Iot Hub |
test_route | exec | iotHubName , subscriptionId , resourceGroupName , route | api-version | Test the new route for this Iot Hub |
export_devices | exec | subscriptionId , resourceGroupName , resourceName , exportBlobContainerUri , excludeKeys | api-version | Exports 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_devices | exec | subscriptionId , resourceGroupName , resourceName , inputBlobContainerUri , outputBlobContainerUri | api-version | Import, 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.
Name | Datatype | Description |
---|---|---|
iotHubName | string | IotHub to be tested |
resourceGroupName | string | The name of the resource group that contains the IoT hub. |
resourceName | string | The name of the IoT hub. |
subscriptionId | string | The subscription identifier. |
If-Match | string | ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. |
api-version | string | The version of the API. |
SELECT
examples
- get
- list_by_resource_group
- list_by_subscription
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 }}'
;
Get all the IoT hubs in a resource group.
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 api-version = '{{ api-version }}'
;
Get all the IoT hubs in a subscription.
SELECT
id,
name,
etag,
identity,
location,
properties,
sku,
systemData,
tags,
type
FROM azure.iot_hub.resources
WHERE subscriptionId = '{{ subscriptionId }}' -- required
AND api-version = '{{ api-version }}'
;
INSERT
examples
- create_or_update
- Manifest
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
;
# Description fields are for documentation purposes
- name: resources
props:
- name: subscriptionId
value: string
description: Required parameter for the resources resource.
- name: resourceGroupName
value: string
description: Required parameter for the resources resource.
- name: resourceName
value: string
description: Required parameter for the resources resource.
- name: etag
value: string
description: |
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.
- name: properties
value: object
description: |
IotHub properties
- name: sku
value: object
description: |
IotHub SKU info
- name: identity
value: object
description: |
The managed identities for the IotHub.
- name: location
value: string
description: |
The resource location.
- name: tags
value: object
description: |
The resource tags.
- name: api-version
value: string
description: The version of the API.
- name: If-Match
value: string
description: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub.
UPDATE
examples
- update
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
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_name_availability
- test_all_routes
- test_route
- export_devices
- import_devices
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 }}"
}'
;
Test all routes configured in this Iot Hub
EXEC azure.iot_hub.resources.test_all_routes
@iotHubName='{{ iotHubName }}' --required,
@subscriptionId='{{ subscriptionId }}' --required,
@resourceGroupName='{{ resourceGroupName }}' --required,
@api-version='{{ api-version }}'
@@json=
'{
"routingSource": "{{ routingSource }}",
"message": "{{ message }}",
"twin": "{{ twin }}"
}'
;
Test the new route for this Iot Hub
EXEC azure.iot_hub.resources.test_route
@iotHubName='{{ iotHubName }}' --required,
@subscriptionId='{{ subscriptionId }}' --required,
@resourceGroupName='{{ resourceGroupName }}' --required,
@api-version='{{ api-version }}'
@@json=
'{
"message": "{{ message }}",
"route": "{{ route }}",
"twin": "{{ twin }}"
}'
;
Exports 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.
EXEC azure.iot_hub.resources.export_devices
@subscriptionId='{{ subscriptionId }}' --required,
@resourceGroupName='{{ resourceGroupName }}' --required,
@resourceName='{{ resourceName }}' --required,
@api-version='{{ api-version }}'
@@json=
'{
"exportBlobContainerUri": "{{ exportBlobContainerUri }}",
"excludeKeys": {{ excludeKeys }},
"exportBlobName": "{{ exportBlobName }}",
"authenticationType": "{{ authenticationType }}",
"identity": "{{ identity }}",
"includeConfigurations": {{ includeConfigurations }},
"configurationsBlobName": "{{ configurationsBlobName }}"
}'
;
Import, 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.
EXEC azure.iot_hub.resources.import_devices
@subscriptionId='{{ subscriptionId }}' --required,
@resourceGroupName='{{ resourceGroupName }}' --required,
@resourceName='{{ resourceName }}' --required,
@api-version='{{ api-version }}'
@@json=
'{
"inputBlobContainerUri": "{{ inputBlobContainerUri }}",
"outputBlobContainerUri": "{{ outputBlobContainerUri }}",
"inputBlobName": "{{ inputBlobName }}",
"outputBlobName": "{{ outputBlobName }}",
"authenticationType": "{{ authenticationType }}",
"identity": "{{ identity }}",
"includeConfigurations": {{ includeConfigurations }},
"configurationsBlobName": "{{ configurationsBlobName }}"
}'
;