Skip to content

Commit 8de387c

Browse files
fix(bicep): guard EventHub and Fabric vars against ARM eager-evaluation; fix README headings
1 parent 0db0aad commit 8de387c

2 files changed

Lines changed: 19 additions & 17 deletions

File tree

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ If you'd like to customize the solution accelerator, here are some common areas
4141

4242
<br/>
4343

44-
### Additional resources
44+
## Resources
4545

4646
[What's New in Microsoft Fabric](https://learn.microsoft.com/en-us/fabric/fundamentals/whats-new)
4747

@@ -53,7 +53,8 @@ If you'd like to customize the solution accelerator, here are some common areas
5353

5454
<br/>
5555

56-
### Key features
56+
## Features
57+
5758
<details>
5859
<summary>Click to learn more about the key features this solution enables</summary>
5960

@@ -79,6 +80,8 @@ If you'd like to customize the solution accelerator, here are some common areas
7980
Quick deploy
8081
</h2>
8182

83+
## Getting Started
84+
8285
### How to install or deploy
8386

8487
Follow these steps to deploy the solution to your own Azure subscription:
@@ -190,6 +193,8 @@ Use cases can be summarized as below:
190193
Supporting documentation
191194
</h2>
192195

196+
## Guidance
197+
193198
### Security guidelines
194199

195200
This template uses Azure Key Vault to store all connections to communicate between resources.

infra/main.bicep

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,20 @@ param existingFabricCapacityName string = ''
6565

6666
// ============================================================================
6767
// Determine whether to use existing resources
68-
// Scenarios:
69-
// 1. Create new namespace + new event hub: existingEventHubNamespaceId not set
70-
// 2. Use existing namespace, create new event hub: existingEventHubNamespaceId is set
71-
//
72-
// NOTE: A new Event Hub is always created to avoid mixing unrelated event types.
73-
// This follows best practices for Event Hub usage.
7468
// ============================================================================
7569

76-
var useExistingEventHubNamespace = !empty(existingEventHubNamespaceId)
77-
// Extract namespace name from resource ID if using existing, otherwise generate new name
78-
var eventHubNamespaceNameFromId = useExistingEventHubNamespace ? last(split(existingEventHubNamespaceId, '/')) : ''
79-
// Parse subscription ID and resource group from the namespace resource ID
80-
// This enables cross-subscription and cross-resource-group deployments
81-
// Example: namespace in sub-123/rg-shared while deploying to sub-456/rg-demo
82-
var eventHubNamespaceSubscriptionId = useExistingEventHubNamespace ? split(existingEventHubNamespaceId, '/')[2] : ''
83-
var eventHubNamespaceResourceGroup = useExistingEventHubNamespace ? split(existingEventHubNamespaceId, '/')[4] : ''
84-
var useExistingFabricCapacity = !empty(existingFabricCapacityName)
70+
// Use an existing namespace if a valid resource ID is provided; otherwise create a new one.
71+
// A new Event Hub is always created to avoid mixing unrelated event types.
72+
var useExistingEventHubNamespace = startsWith(existingEventHubNamespaceId, '/subscriptions/')
73+
// Fallback placeholder ensures split() is always called on a well-formed resource ID.
74+
var _safeEventHubNamespaceId = useExistingEventHubNamespace
75+
? existingEventHubNamespaceId
76+
: '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/placeholder/providers/Microsoft.EventHub/namespaces/placeholder'
77+
var eventHubNamespaceNameFromId = last(split(_safeEventHubNamespaceId, '/'))
78+
var eventHubNamespaceSubscriptionId = split(_safeEventHubNamespaceId, '/')[2]
79+
var eventHubNamespaceResourceGroup = split(_safeEventHubNamespaceId, '/')[4]
80+
// Use an existing Fabric capacity if a valid name is provided; otherwise create a new one.
81+
var useExistingFabricCapacity = !empty(existingFabricCapacityName) && !startsWith(existingFabricCapacityName, '$')
8582

8683
var solutionSuffix = toLower(trim(replace(
8784
replace(

0 commit comments

Comments
 (0)