def METHOD_NAME(key_name: Optional[str] = None,
                                            resource_group_name: Optional[str] = None,
                                            resource_name: Optional[str] = None,
                                            opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableListIotHubResourceKeysForKeyNameResult:
    """
    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.
    :param str key_name: The name of the shared access policy.
    :param str resource_group_name: The name of the resource group that contains the IoT hub.
    :param str resource_name: The name of the IoT hub.
    """
    __args__ = dict()
    __args__['keyName'] = key_name
    __args__['resourceGroupName'] = resource_group_name
    __args__['resourceName'] = resource_name
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('azure-native:devices/v20230630:listIotHubResourceKeysForKeyName', __args__, opts=opts, typ=ListIotHubResourceKeysForKeyNameResult).value
    return AwaitableListIotHubResourceKeysForKeyNameResult(
        key_name=pulumi.get(__ret__, 'key_name'),
        primary_key=pulumi.get(__ret__, 'primary_key'),
        rights=pulumi.get(__ret__, 'rights'),
        secondary_key=pulumi.get(__ret__, 'secondary_key'))