Add a customizable ID for package policy

Hello,

I am trying to create a policy package using the Kibana Dev Tools and I wondered if it was possible to apply a unique customizable ID.

For example, I want to create osquery manager package policy with ID "osquery_manager_1".

Request :

POST kbn:/api/fleet/package_policies
{
  "policy_id": "agent_policy",
  "package": {
    "name": "osquery_manager",
    "version": "1.5.1"
  },
  "name": "osquery_manager_1",
  "id": "osquery_manager_1"
  "description": "osquery manager",
  "namespace": "default",
  "inputs": {
    "osquery_manager-osquery": {
      "enabled": true,
      "streams": {
        "osquery_manager.result": {
          "enabled": true,
          "vars": {}
        }
      }
    }
  }
}

I have the following response :

{
  "item": {
    **"id": "9de387f0-1b78-11ee-998e-a17c25uif75e"**,
    "version": "WzTwVywxXQ==",
    "name": "osquery_manager_1",
    "namespace": "default",
    "description": "osquery manager",
    "package": {
      "name": "osquery_manager",
      "title": "Osquery Manager",
      "version": "1.5.1"
    },
    "enabled": true,
    "policy_id": "agent_policy",
    "inputs": [
      {
        "type": "osquery",
        "policy_template": "osquery_manager",
        "enabled": true,
        "streams": [
          {
            "enabled": true,
            "data_stream": {
              "type": "logs",
              "dataset": "osquery_manager.result"
            },
            "vars": {
              "query": {
                "type": "text"
              },
              "interval": {
                "type": "text"
              },
              "id": {
                "type": "text"
              },
              "platform": {
                "type": "text"
              },
              "version": {
                "type": "text"
              }
            },
            "id": "osquery-osquery_manager.result-9de387f0-1b78-11ee-998e-a17c25uif75e",
            "compiled_stream": {
              "query": null,
              "id": null
            }
          }
        ]
      }
    ],
    "revision": 1,
    "created_at": "2023-07-05T14:52:50.518Z",
    "created_by": "elastic",
    "updated_at": "2023-07-05T14:52:50.518Z",
    "updated_by": "elastic"
  }
}

As you can see the ID is a random set of numbers and not my ID "osquery_manager_1".

So is it possible to customize the ID of a package policy?

Thanks in advance.

Hi @Bearloggs

It seems it's a bug in our package policy API, I just created an issue so we can work on fixing that [Fleet] POST package policy api id field is not honoured · Issue #161303 · elastic/kibana · GitHub

Thanks for your help !

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.