Pripravujeme pre Vás novú dokumentáciu, aktuálny stav nájdete tu

CDESK SCRIPT EXAMPLE

WITH ESET PROTECT(AZURE VERSION)

Overview

This logic app in Azure is an example of how to apply CDESK scripts to import data about computers (PC/Notebook/Server) from ESET PROTECT via the Cloud API into the CDESK Configuration database.

The device data is retrieved from the ESET PROTECT cloud service, then processed and used to create CI items in CDESK.

A similar scenario can be implemented with any other data source, such as your database, the API of other websites, or data stored in files (for example .xlsx or .json). However, because Azure is a cloud service, your data should be extractable from the internet, so local files/DB will not work.

Presets

Before running the logic app, the target CDESK environment is expected to have a CI type under the Main groups that contains the following subfields:

  • Device model: string
  • Serial number: string
  • External number: string
  • Operating system (OS): string
  • Device type: string

Step-by-step guide to creating such a CI type (‚Computers from ESET console‘):

Step 1

Step 2

Step 3

Step 4

Step 5

Step 6

Setting up the Azure service

To import an Azure resource group with the required resources, you can use the template in the template.bicep file. For this you will need your subscription ID (Search -> type ‚Subscriptions‘ -> select your subscription or create a new one) and tenant ID (Search -> type ‚Microsoft Entra ID‘).

Then follow the steps below to complete the import:

  1. Log in to the Azure portal and go to the CLI (top right corner of the page, Bash console).
  2. If prompted, create storage for this console.
  3. Upload the template.bicep file using the button (or alternatively).
  4. Create a resource group: az group create –name <resource group name> –location (example location: westeurope)
    1. In the same Azure CLI directory where this file is located, run:

    az deployment group create –resource-group <resource group name> –template-file ./template.bicep –parameters keyVaultName=<key vault name> logicAppName=<logic app name> subscriptionId=<your subscription ID> tenantId=<your tenant ID> cdeskLogin= cdeskPwd= esetLogin= esetPwd= (without <>)

    The import process may throw some warnings, but the objects should be created without problems. After some time you should see the newly created resources in the chosen resource group.

  5. When you finish the import, go to the target resource group, select your Key Vault (key icon) and go to Access Control (IAM). There you should add a new role assignment (search for the role ‚Key Vault Administrator‘) for your account so that you can view and change the secret keys. Also add the role ‚Key Vault Secrets User‘ for the Managed Identity of the recently created Logic App.
  6. Once the roles are added, you can continue setting/changing the values of the secrets (key vault) and the logic app parameters.

The key vault contains some private data that should not be disclosed, such as logins and passwords:

ESET_LOGIN – your login name for the ESET PROTECT account

ESET_PASSWORD – your password for the ESET PROTECT account

CDESK_LOGIN – your login name for the CDESK account

CDESK_PASSWORD – your password for the CDESK account

These values will be assigned during import, but you can change them in the resource group’s key vault.

The logic app has the following parameters that you should set before running it:

CDESK_SERVER – your CDESK server (e.g. ‚cdeskportal.eu‘)

MAINGROUP_ID – ID of the main group of the created CI type

TYPE_ID – ID of the created CI type (‚Computers from ESET console‘)

COMPANY_ID – ID of your company in CDESK

CATEGORY_ID – ID of the category related to the main group

PROPERTY_GROUP_ID – ID of the custom fields group of the given CI type

PROPERTY_TYPE_ID – ID of the type (boolean, integer, string, …) of the custom field of the given CI type

DEVICE_MODEL_ID – ID of the model property

DEVICE_MODEL_BASEPROPERTY_ID – ID of the base model property

DEVICE_SN_ID – ID of the serial number property

DEVICE_SN_BASEPROPERTY_ID – ID of the base serial number property

DEVICE_PN_ID – ID of the external ID property

DEVICE_PN_BASEPROPERTY_ID – ID of the base external ID property

DEVICE_OS_ID – ID of the operating system property

DEVICE_OS_BASEPROPERTY_ID – ID of the base operating system property

DEVICE_TYPE_ID – ID of the device type property

DEVICE_TYPE_BASEPROPERTY_ID – ID of the base device type property

Usage

Once all the secrets are in the key vault and the logic app parameters are set, you can run the logic app to perform the import of PC/Server data from ESET PROTECT. The logic app can be triggered by sending a request (POST, empty body) to the URL shown in the trigger element (the first element of the workflow, ‚When an HTTP Request is received‘, or by using the ‚Run Trigger‘ (‚Run‘) button.

Note: If some records (computers/servers) already existed in CDESK before running this script, they will not be created and the script code responsible for importing them will display the status Failed. In this case this is fine and the script works as expected. Successfully created records return the status OK (200).

Workflow