Skip to main content

resource_keys_for_key_names

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

Overview

Nameresource_keys_for_key_names
TypeResource
Idazure.iot_hub.resource_keys_for_key_names

Fields

The following fields are returned by SELECT queries:

This is a synchronous operation. The body contains a JSON-serialized shared access policy, including keys, that you can use to access one or more IoT hub endpoints.

NameDatatypeDescription
keyNamestringThe name of the shared access policy.
primaryKeystringThe primary key.
rightsstringThe permissions assigned to the shared access policy.
secondaryKeystringThe secondary key.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectsubscriptionId, resourceGroupName, resourceName, keyNameapi-versionGet a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.

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
keyNamestringThe name of the shared access policy.
resourceGroupNamestringThe name of the resource group that contains the IoT hub.
resourceNamestringThe name of the IoT hub.
subscriptionIdstringThe subscription identifier.
api-versionstringThe version of the API.

SELECT examples

Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.

SELECT
keyName,
primaryKey,
rights,
secondaryKey
FROM azure.iot_hub.resource_keys_for_key_names
WHERE subscriptionId = '{{ subscriptionId }}' -- required
AND resourceGroupName = '{{ resourceGroupName }}' -- required
AND resourceName = '{{ resourceName }}' -- required
AND keyName = '{{ keyName }}' -- required
AND api-version = '{{ api-version }}'
;