From a906c732b02cb54e9f19c00c01c2a526ce2d450f Mon Sep 17 00:00:00 2001 From: Nicolas Chaulet Date: Mon, 13 Jul 2020 11:00:58 -0400 Subject: [PATCH] [Ingest Manager] During fleet setup create an enrollment for every config (#71308) --- .../ingest_manager/server/services/setup.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/ingest_manager/server/services/setup.ts b/x-pack/plugins/ingest_manager/server/services/setup.ts index e27a5456a5a7d..627abc158143d 100644 --- a/x-pack/plugins/ingest_manager/server/services/setup.ts +++ b/x-pack/plugins/ingest_manager/server/services/setup.ts @@ -180,11 +180,18 @@ export async function setupFleet( fleet_enroll_password: password, }); - // Generate default enrollment key - await generateEnrollmentAPIKey(soClient, { - name: 'Default', - configId: await agentConfigService.getDefaultAgentConfigId(soClient), + const { items: agentConfigs } = await agentConfigService.list(soClient, { + perPage: 10000, }); + + await Promise.all( + agentConfigs.map((agentConfig) => { + return generateEnrollmentAPIKey(soClient, { + name: `Default`, + configId: agentConfig.id, + }); + }) + ); } function generateRandomPassword() {