From 66c5f83934ddd878aa17aa66967cf8498588b1a9 Mon Sep 17 00:00:00 2001 From: Jeff Omhover Date: Mon, 5 Jan 2026 14:19:43 -0800 Subject: [PATCH] use onyIfNotExists flag for cap host creation --- infra/core/ai/ai-project.bicep | 3 +++ 1 file changed, 3 insertions(+) diff --git a/infra/core/ai/ai-project.bicep b/infra/core/ai/ai-project.bicep index d0e8753..87ab0f3 100644 --- a/infra/core/ai/ai-project.bicep +++ b/infra/core/ai/ai-project.bicep @@ -122,6 +122,9 @@ resource aiAccount 'Microsoft.CognitiveServices/accounts@2025-06-01' = { ] } + // Capability host creation can happen only once. Running the bicep twice will lead to an error. + // We're using @onlyIfNotExists() to avoid errors on re-deployments. + @onlyIfNotExists() resource aiFoundryAccountCapabilityHost 'capabilityHosts@2025-10-01-preview' = if (enableHostedAgents) { name: 'agents' properties: {