Skip to content

Commit d931ef6

Browse files
Merge pull request #142 from microsoft/dev
chore: dev to main merge
2 parents f1cbea8 + 4371b2e commit d931ef6

14 files changed

Lines changed: 5636 additions & 61 deletions

azure.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: deploy-your-ai-application-in-production
22

33
requiredVersions:
44
azd: ">=1.15.0 != 1.23.9"
5-
bicep: '>= 0.33.0'
65

76
infra:
87
provider: "bicep"

docs/deploymentguide.md

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,42 @@ Edit `infra/main.bicepparam` or set environment variables:
191191
# var fabricWorkspacePreset = 'none'
192192
```
193193

194+
#### Reusing an Existing Fabric Capacity and Workspace (BYO mode)
195+
196+
If you already have a Fabric capacity and workspace, set `byo` mode so the deployment skips creating new ones. The bicepparam variables are driven by environment variables, so the recommended approach is to set them with `azd env set` before running `azd up`:
197+
198+
**Step 1 — Set the mode** ( The default value is `create`, so override it to `byo`):
199+
200+
```bicep
201+
// infra/main.bicepparam
202+
var fabricCapacityPreset = readEnvironmentVariable('fabricCapacityMode', 'create')
203+
```
204+
205+
The `fabricCapacityMode` env variable controls both capacity and workspace preset (they are tied together). Set it explicitly to use BYO mode:
206+
207+
```powershell
208+
azd env set fabricCapacityMode byo
209+
```
210+
211+
**Step 2 — Supply the existing resource identifiers:**
212+
213+
```powershell
214+
# ARM resource ID of the existing Fabric capacity
215+
azd env set fabricCapacityResourceId "/subscriptions/<sub-id>/resourceGroups/<rg>/providers/Microsoft.Fabric/capacities/<capacity-name>"
216+
217+
# GUID of the existing Fabric workspace (from the workspace URL or Fabric portal)
218+
azd env set FABRIC_WORKSPACE_ID "<workspace-guid>"
219+
220+
# Display name of the existing workspace (used for naming/UX; optional but recommended)
221+
azd env set FABRIC_WORKSPACE_NAME "<workspace-display-name>"
222+
```
223+
224+
> **How to find the workspace GUID:** Open the workspace in [app.fabric.microsoft.com](https://app.fabric.microsoft.com), copy the URL. The segment after `/groups/` is the workspace GUID (e.g., `https://app.fabric.microsoft.com/groups/e9c7ed61-0cdc-4356-a239-9d49cc755fe0/...``e9c7ed61-0cdc-4356-a239-9d49cc755fe0`).
225+
226+
> **How to find the capacity resource ID:** In Azure Portal, open the Fabric capacity resource → **Properties** → copy **Resource ID**. It follows the pattern `/subscriptions/.../providers/Microsoft.Fabric/capacities/<name>`.
227+
228+
After setting these variables, run `azd up` normally. The deployment will attach to your existing capacity and workspace instead of creating new ones.
229+
194230
</details>
195231

196232
<details>
@@ -209,15 +245,9 @@ For network-isolated deployments, set the VM credentials before running `azd up`
209245

210246
```powershell
211247
azd env set VM_ADMIN_USERNAME "youradminuser"
212-
azd env set VM_ADMIN_PASSWORD "Use-A-Strong-Password-Here!"
248+
azd env set VM_ADMIN_PASSWORD "<your-strong-password>"
213249
```
214250

215-
If you prefer source-controlled defaults, set them in [infra/main.bicepparam](../infra/main.bicepparam) instead:
216-
217-
```bicep
218-
param vmUserName = 'youradminuser'
219-
param vmAdminPassword = 'Use-A-Strong-Password-Here!'
220-
```
221251

222252
</details>
223253

docs/parameter_guide.md

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,80 @@ This guide focuses on configuration concepts for the **AI Landing Zone**.
88
> - AI Landing Zone submodule parameters file (if you deploy it directly): `submodules/ai-landing-zone/main.parameters.json`
99
>
1010
> **Fabric options in this repo** are configured in `infra/main.bicepparam` via:
11-
> - `fabricCapacityPreset` (`create` | `byo` | `none`)
12-
> - `fabricWorkspacePreset` (`create` | `byo` | `none`)
13-
> - BYO inputs: `fabricCapacityResourceId`, `fabricWorkspaceId`, `fabricWorkspaceName`
11+
> - `fabricCapacityPreset` (`create` | `byo` | `none`) — driven by the `fabricCapacityMode` env variable
12+
> - `fabricWorkspacePreset` (`create` | `byo` | `none`) — mirrors `fabricCapacityPreset` by default
13+
> - BYO inputs: `fabricCapacityResourceId` (env), `FABRIC_WORKSPACE_ID` (env), `FABRIC_WORKSPACE_NAME` (env)
1414
1515
> **Deployment flow**: This repo deploys the AI Landing Zone submodule from `submodules/ai-landing-zone/main.bicep` during the preprovision hook. The single source of truth for parameters is `infra/main.bicepparam`.
1616
17+
## Fabric Configuration
18+
19+
### Modes: create, byo, none
20+
21+
| Mode | Description |
22+
|------|-------------|
23+
| `create` | Provisions a new Fabric capacity (Bicep) and workspace (postprovision script) |
24+
| `byo` | Reuses an existing Fabric capacity and workspace — no new resources created |
25+
| `none` | Disables all Fabric automation; OneLake indexing will be skipped |
26+
27+
Both capacity and workspace modes are controlled by the same `fabricCapacityMode` environment variable (they are tied together in `infra/main.bicepparam`).
28+
29+
### Setting Mode via azd env
30+
31+
The recommended way to configure Fabric mode is with `azd env set` — these values are read directly by `infra/main.bicepparam` at provision time:
32+
33+
```powershell
34+
# Choose one:
35+
azd env set fabricCapacityMode create # create new capacity + workspace (default if not set)
36+
azd env set fabricCapacityMode byo # reuse existing capacity + workspace
37+
azd env set fabricCapacityMode none # disable all Fabric automation
38+
```
39+
40+
### Reusing Existing Fabric Resources (BYO)
41+
42+
When `fabricCapacityMode` is `byo`, supply the identifiers of your existing resources:
43+
44+
```powershell
45+
# ARM resource ID of the existing Fabric capacity
46+
azd env set fabricCapacityResourceId "/subscriptions/<sub-id>/resourceGroups/<rg>/providers/Microsoft.Fabric/capacities/<capacity-name>"
47+
48+
# GUID of the existing Fabric workspace (from the workspace URL)
49+
azd env set FABRIC_WORKSPACE_ID "<workspace-guid>"
50+
51+
# Display name of the existing workspace (optional, used for naming/UX)
52+
azd env set FABRIC_WORKSPACE_NAME "<workspace-display-name>"
53+
```
54+
55+
> **How to find the workspace GUID:** Open the workspace in [app.fabric.microsoft.com](https://app.fabric.microsoft.com). The URL segment after `/groups/` is the GUID (e.g., `https://app.fabric.microsoft.com/groups/e9c7ed61-0cdc-4356-a239-9d49cc755fe0/...`).
56+
>
57+
> **How to find the capacity resource ID:** Azure Portal → Fabric capacity resource → **Properties****Resource ID**.
58+
59+
You can also set these directly in `infra/main.bicepparam` if you prefer source-controlled values:
60+
61+
```bicep
62+
// infra/main.bicepparam
63+
var fabricCapacityPreset = 'byo'
64+
param fabricCapacityResourceId = '/subscriptions/<sub-id>/resourceGroups/<rg>/providers/Microsoft.Fabric/capacities/<name>'
65+
param fabricWorkspaceId = '<workspace-guid>'
66+
param fabricWorkspaceName = '<workspace-display-name>'
67+
```
68+
69+
> **Note:** Values set via `azd env set` take precedence over hardcoded bicepparam values because `readEnvironmentVariable(...)` is evaluated at deploy time.
70+
71+
### Creating New Fabric Resources
72+
73+
When `fabricCapacityMode` is `create`, you must provide at least one admin principal:
74+
75+
```bicep
76+
// infra/main.bicepparam
77+
param fabricCapacityAdmins = ['user@contoso.com']
78+
param fabricCapacitySku = 'F2' // adjust SKU as needed
79+
```
80+
81+
> **Permission requirement:** The identity running `azd` must have the **Fabric Administrator** role (or Power BI tenant admin) to call the workspace admin APIs used during postprovision.
82+
83+
---
84+
1785
## Table of Contents
1886
1. [Basic Parameters](#basic-parameters)
1987
2. [Deployment Toggles](#deployment-toggles)

docs/post_deployment_steps.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ If the connection fails, verify RBAC roles are assigned (see Troubleshooting sec
149149

150150
If `purviewCollectionName` is left empty in [infra/main.bicepparam](../infra/main.bicepparam), the automation now uses `collection-<AZURE_ENV_NAME>`.
151151

152+
> **Note:** If a tenant-level Fabric datasource already exists under a different collection, the scan script automatically reparents the deployment collection as a child of the datasource's collection. This ensures scans comply with Purview's requirement that scans are created within the datasource's collection hierarchy. In the Purview portal, your deployment collection may appear nested under the datasource's collection rather than at the root.
153+
152154
If the identity running `azd` does not have **Purview Collection Admin** (or equivalent) on the target collection, the Purview scripts will warn and skip collection, datasource, and scan steps. Grant the role, then rerun the Purview scripts.
153155

154156
If you need to rerun the Purview steps after provisioning:
@@ -289,10 +291,13 @@ pwsh ./scripts/automationScripts/OneLakeIndex/06_setup_ai_foundry_search_rbac.ps
289291
2. Check scan configuration:
290292
- Purview Portal → Data Map → Sources → Fabric source → Scans
291293

292-
3. Re-run the registration script:
294+
3. **`Scan_CollectionOutOfBound` error:** Purview requires that scans are created under the datasource's collection or a child of it. If your deployment collection is not under the datasource's collection, the scan script will attempt to reparent it automatically. If this fails, manually move your deployment collection under the datasource's collection in Purview Portal → Data Map → Collections.
295+
296+
4. Re-run the scan pipeline:
293297
```bash
294298
eval $(azd env get-values)
295299
pwsh ./scripts/automationScripts/FabricWorkspace/CreateWorkspace/register_fabric_datasource.ps1
300+
pwsh ./scripts/automationScripts/FabricPurviewAutomation/trigger_purview_scan_for_fabric_workspace.ps1
296301
```
297302

298303
### Post-Provision Hooks Failed

infra/main.bicep

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ param postgreSqlFabricUserSecretName string = 'postgres-fabric-user-password'
273273
param postgreSqlMirrorConnectionMode string = 'fabricUser'
274274

275275
@description('Authentication configuration for PostgreSQL Flexible Server. Defaults to both Microsoft Entra and password authentication enabled so Fabric mirroring can be configured immediately after deployment.')
276-
param postgreSqlAuthConfig resourceInput<'Microsoft.DBforPostgreSQL/flexibleServers@2025-06-01-preview'>.properties.authConfig = {
276+
param postgreSqlAuthConfig resourceInput<'Microsoft.DBforPostgreSQL/flexibleServers@2025-08-01'>.properties.authConfig = {
277277
activeDirectoryAuth: 'Enabled'
278278
passwordAuth: 'Enabled'
279279
}
@@ -369,17 +369,17 @@ var effectivePostgreSqlAdminPassword = postgreSqlAdminPassword == '$(secretOrRan
369369
? '${uniqueString(subscription().id, resourceGroup().id, postgreSqlServerName)}!${replace(generatedPostgreSqlAdminPassword, '-', '')}'
370370
: postgreSqlAdminPassword
371371

372-
resource keyVault 'Microsoft.KeyVault/vaults@2023-07-01' existing = {
372+
resource keyVault 'Microsoft.KeyVault/vaults@2026-02-01' existing = {
373373
name: last(split(effectiveKeyVaultResourceId, '/'))
374374
}
375375

376-
resource postgreSqlPrivateDnsZone 'Microsoft.Network/privateDnsZones@2020-06-01' = if (deployPostgreSql && postgreSqlNetworkIsolation) {
376+
resource postgreSqlPrivateDnsZone 'Microsoft.Network/privateDnsZones@2024-06-01' = if (deployPostgreSql && postgreSqlNetworkIsolation) {
377377
name: postgreSqlPrivateDnsZoneName
378378
location: 'global'
379379
tags: deploymentTags
380380
}
381381

382-
resource postgreSqlPrivateDnsZoneVnetLink 'Microsoft.Network/privateDnsZones/virtualNetworkLinks@2020-06-01' = if (deployPostgreSql && postgreSqlNetworkIsolation && deployPostgreSqlPrivateDnsLink) {
382+
resource postgreSqlPrivateDnsZoneVnetLink 'Microsoft.Network/privateDnsZones/virtualNetworkLinks@2024-06-01' = if (deployPostgreSql && postgreSqlNetworkIsolation && deployPostgreSqlPrivateDnsLink) {
383383
name: effectivePostgreSqlPrivateDnsLinkName
384384
parent: postgreSqlPrivateDnsZone
385385
location: 'global'
@@ -428,11 +428,11 @@ module postgreSqlFlexibleServer 'br/public:avm/res/db-for-postgre-sql/flexible-s
428428
}
429429
}
430430

431-
resource postgreSqlFlexibleServerResource 'Microsoft.DBforPostgreSQL/flexibleServers@2025-06-01-preview' existing = if (deployPostgreSql) {
431+
resource postgreSqlFlexibleServerResource 'Microsoft.DBforPostgreSQL/flexibleServers@2025-08-01' existing = if (deployPostgreSql) {
432432
name: postgreSqlServerName
433433
}
434434

435-
resource postgreSqlAllowAzureServicesFirewallRule 'Microsoft.DBforPostgreSQL/flexibleServers/firewallRules@2025-01-01-preview' = if (deployPostgreSql && !postgreSqlNetworkIsolation && postgreSqlAllowAzureServices) {
435+
resource postgreSqlAllowAzureServicesFirewallRule 'Microsoft.DBforPostgreSQL/flexibleServers/firewallRules@2025-08-01' = if (deployPostgreSql && !postgreSqlNetworkIsolation && postgreSqlAllowAzureServices) {
436436
parent: postgreSqlFlexibleServerResource
437437
name: 'AllowAzureServices'
438438
properties: {
@@ -444,7 +444,7 @@ resource postgreSqlAllowAzureServicesFirewallRule 'Microsoft.DBforPostgreSQL/fle
444444
]
445445
}
446446

447-
resource postgreSqlAdminSecret 'Microsoft.KeyVault/vaults/secrets@2023-07-01' = if (deployPostgreSql && enablePostgreSqlKeyVaultSecret) {
447+
resource postgreSqlAdminSecret 'Microsoft.KeyVault/vaults/secrets@2026-02-01' = if (deployPostgreSql && enablePostgreSqlKeyVaultSecret) {
448448
name: postgreSqlAdminSecretName
449449
parent: keyVault
450450
properties: {

infra/main.bicepparam

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,11 @@ var fabricWorkspacePreset = fabricCapacityPreset
236236
param deployFabricCapacity = fabricCapacityPreset != 'none'
237237

238238
param fabricCapacityMode = fabricCapacityPreset
239-
param fabricCapacityResourceId = '' // required when fabricCapacityPreset='byo'
239+
param fabricCapacityResourceId = readEnvironmentVariable('fabricCapacityResourceId', '') // required when fabricCapacityPreset='byo'
240240

241241
param fabricWorkspaceMode = fabricWorkspacePreset
242-
param fabricWorkspaceId = '' // required when fabricWorkspacePreset='byo'
243-
param fabricWorkspaceName = '' // optional (helpful for naming/UX)
242+
param fabricWorkspaceId = readEnvironmentVariable('FABRIC_WORKSPACE_ID', readEnvironmentVariable('fabricWorkspaceId', '')) // required when fabricWorkspacePreset='byo'
243+
param fabricWorkspaceName = readEnvironmentVariable('FABRIC_WORKSPACE_NAME', readEnvironmentVariable('fabricWorkspaceName', '')) // optional (helpful for naming/UX)
244244

245245
// Fabric capacity SKU.
246246
param fabricCapacitySku = 'F8'

0 commit comments

Comments
 (0)