Skip to content

feat: add postgre and fabric mirror#117

Open
mswantek68 wants to merge 18 commits intomainfrom
feat/addPostgreFabricMirror
Open

feat: add postgre and fabric mirror#117
mswantek68 wants to merge 18 commits intomainfrom
feat/addPostgreFabricMirror

Conversation

@mswantek68
Copy link
Collaborator

Purpose

Replace sub module location, add postgreSQL provisioning, add Fabric mirror of PostgreSQL DB

Does this introduce a breaking change?

  • [ X] Yes
  • No

Golden Path Validation

  • [ x] I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.

Deployment Validation

  • [ x] I have validated the deployment process successfully and all services are running as expected with this change.

What to Check

Verify that the following are valid
Follow post_deployment_steps.md for listing

Other Information

As reviewed with team on 3-10-26

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the AI Landing Zone submodule source and reworks provisioning/automation to add PostgreSQL Flexible Server provisioning plus Fabric mirroring support, while improving resiliency of post-provision scripts (outputs-based configuration, retries, and safer error handling).

Changes:

  • Switch AI Landing Zone submodule to a new upstream repo and change preprovision to deploy the submodule directly via az deployment group create.
  • Add PostgreSQL Flexible Server provisioning in the wrapper Bicep, plus PowerShell automation to prep PostgreSQL for Fabric mirroring and create a mirrored database.
  • Improve automation scripts to prefer AZURE_OUTPUTS_JSON, add retries/guardrails, and introduce a Purview skip flag.

Reviewed changes

Copilot reviewed 31 out of 32 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
submodules/ai-landing-zone Updates submodule commit pointer to the new upstream state.
scripts/preprovision-integrated.ps1 Replaces preprovision flow with direct submodule deployment + env output publishing.
scripts/automationScripts/SecurityModule.ps1 Enhances REST error sanitization and adds HTTP status/body diagnostics.
scripts/automationScripts/OneLakeIndex/setup_ai_services_rbac.ps1 Adds AI Foundry project existence checks to improve RBAC setup reliability.
scripts/automationScripts/OneLakeIndex/06_setup_ai_foundry_search_rbac.ps1 Pulls settings from outputs, discovers project, and improves additional principals parsing.
scripts/automationScripts/OneLakeIndex/05_create_onelake_indexer.ps1 Adds public access toggle + retry handling for Search requests and RBAC propagation.
scripts/automationScripts/OneLakeIndex/04_create_onelake_datasource.ps1 Same Search public-access toggle + retry layer; prefers outputs for config.
scripts/automationScripts/OneLakeIndex/03_create_onelake_index.ps1 Same Search public-access toggle + retry layer; prefers outputs for config.
scripts/automationScripts/OneLakeIndex/02_create_onelake_skillsets.ps1 Same Search public-access toggle + retry layer; prefers outputs for config.
scripts/automationScripts/OneLakeIndex/01_setup_rbac.ps1 Prefers outputs for Search/Foundry values used during RBAC.
scripts/automationScripts/FabricWorkspace/mirror/run_postgresql_mirroring_prep_with_public_access.ps1 Adds wrapper to temporarily enable public access for KV/PG during mirroring prep.
scripts/automationScripts/FabricWorkspace/mirror/prepare_postgresql_for_mirroring.ps1 Adds PostgreSQL mirroring preparation (params, roles/grants, seed table).
scripts/automationScripts/FabricWorkspace/mirror/create_postgresql_mirror.ps1 Adds Fabric API automation for creating a mirrored database once a connection exists.
scripts/automationScripts/FabricWorkspace/CreateWorkspace/register_fabric_datasource.ps1 Adds SKIP_PURVIEW_INTEGRATION short-circuit.
scripts/automationScripts/FabricWorkspace/CreateWorkspace/materialize_document_folders.ps1 Improves retry behavior and idempotency checks for folder materialization.
scripts/automationScripts/FabricWorkspace/CreateWorkspace/create_fabric_workspace.ps1 Moves from Power BI to Fabric API and updates admin/capacity assignment flows.
scripts/automationScripts/FabricPurviewAutomation/trigger_purview_scan_for_fabric_workspace.ps1 Adds skip flag and retry logic around scan create/run.
scripts/automationScripts/FabricPurviewAutomation/create_purview_collection.ps1 Adds skip flag to avoid running Purview setup.
scripts/automationScripts/FabricPurviewAutomation/connect_log_analytics.ps1 Removes placeholder Log Analytics linkage script.
infra/main.bicepparam Reorganizes parameters and adds PostgreSQL + mirror-related inputs/toggles.
infra/main.bicep Adds PostgreSQL provisioning and updates wrapper outputs for scripts.
docs/quota_check.md Clarifies terminal requirements for quota script vs deployment.
docs/postgresql_mirroring.md Adds end-to-end runbook for Fabric mirroring with what’s automated vs manual.
docs/post_deployment_steps.md Adds PostgreSQL mirroring verification steps and updates network isolation wording.
docs/automation-outputs-mapping.md Updates mapping descriptions for resolved Fabric modes.
docs/PARAMETER_GUIDE.md Updates submodule param references and documents PostgreSQL options.
docs/DeploymentGuide.md Updates Windows shell guidance and reflects new preprovision/deployment flow.
azure.yaml Switches preprovision to pwsh and adds PostgreSQL mirroring steps.
README.md Updates architecture image, upstream link, and adds PostgreSQL mirroring doc link.
CHANGELOG.md Adds Unreleased notes for new behaviors and script changes.
.gitmodules Updates submodule URL to new upstream repository.
.gitignore Ignores a new local copy parameter file.
Comments suppressed due to low confidence (3)

scripts/preprovision-integrated.ps1:1

  • The GUID validation regex ^[0-9a-fA-F-]{36}$ is too permissive (it accepts many invalid GUID strings). Use [guid]::TryParse(...) (or a stricter GUID regex) to ensure AZURE_PRINCIPAL_ID / principalId is a valid GUID before relying on it for RBAC and deployment parameters.
    scripts/preprovision-integrated.ps1:1
  • The GUID validation regex ^[0-9a-fA-F-]{36}$ is too permissive (it accepts many invalid GUID strings). Use [guid]::TryParse(...) (or a stricter GUID regex) to ensure AZURE_PRINCIPAL_ID / principalId is a valid GUID before relying on it for RBAC and deployment parameters.
    scripts/preprovision-integrated.ps1:1
  • The Select-String pattern only matches parameters that start at column 0. If the submodule formats parameters with indentation (or has leading whitespace), valid params will be missed and silently dropped from $filtered.parameters, causing deployment failures due to missing required params. Use a pattern that allows leading whitespace (e.g., ^\\s*param\\s+...).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mswantek68 mswantek68 changed the title feat! add postgre and fabric mirror feat add postgre and fabric mirror Mar 18, 2026
@mswantek68 mswantek68 requested a review from Copilot March 18, 2026 20:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 31 out of 32 changed files in this pull request and generated 8 comments.

Comments suppressed due to low confidence (2)

scripts/preprovision-integrated.ps1:1

  • The GUID validation regex ^[0-9a-fA-F-]{36}$ is overly permissive (it accepts many non-GUID 36-char strings with hyphens in the wrong places). This can lead to invalid principalId being accepted and later causing RBAC/deployment failures. Prefer strict GUID parsing (e.g., [guid]::TryParse(...)) for validation.
    scripts/preprovision-integrated.ps1:1
  • The GUID validation regex ^[0-9a-fA-F-]{36}$ is overly permissive (it accepts many non-GUID 36-char strings with hyphens in the wrong places). This can lead to invalid principalId being accepted and later causing RBAC/deployment failures. Prefer strict GUID parsing (e.g., [guid]::TryParse(...)) for validation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mswantek68 mswantek68 changed the title feat add postgre and fabric mirror feat: add postgre and fabric mirror Mar 18, 2026
@mswantek68 mswantek68 requested a review from Copilot March 19, 2026 13:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 31 out of 32 changed files in this pull request and generated 10 comments.

Comments suppressed due to low confidence (1)

scripts/preprovision-integrated.ps1:1

  • The regex ^param\s+(\w+) only matches param at column 1. In Bicep, parameters can be indented and/or preceded by decorators, so this can miss valid params and produce an incomplete $filteredParams file (leading to ARM/Bicep validation errors due to missing required parameters). Use a whitespace-tolerant pattern (e.g., ^\s*param\s+(\w+)) and consider accounting for decorator lines (or using az bicep build --stdout/a safer parsing approach) so the allowlist is accurate.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 231 to 232
$groups = Invoke-SecureRestMethod -Uri "$apiRoot/groups?%24top=5000" -Headers $apiHeaders -Method Get -ErrorAction Stop
$g = $groups.value | Where-Object { $_.name -eq $WorkspaceName }
}
}

Invoke-SecureWebRequest -Uri "$apiRoot/workspaces/$workspaceId/roleAssignments" -Method Post -Headers ($apiHeaders) -Body (@{ principal = @{ id = $pincipalId; type = 'User' }; role = 'Admin' } | ConvertTo-Json) -ErrorAction Stop
Comment on lines +263 to +265
# Set server parameters for mirroring
$changed = $false
$needsRestart = $false
Comment on lines +282 to +290
function Set-ParamValue([string]$paramName, [string]$value, [bool]$requiresRestart) {
$current = Get-ParamValue $paramName
if ($current -ne $value) {
Log "Setting $paramName to '$value' (was '$current')"
az postgres flexible-server parameter set -g $resourceGroup -s $postgreSqlServerName -n $paramName --value $value --subscription $subscriptionId 1>$null
$script:changed = $true
if ($requiresRestart) { $script:needsRestart = $true }
}
}
Set-ParamValue -paramName 'max_worker_processes' -value $targetWorkers.ToString() -requiresRestart $true
}

if ($changed -and $needsRestart) {
Comment on lines +301 to +306
# Increase max_worker_processes by 3 per mirrored database
$maxWorkers = Get-ParamValue 'max_worker_processes'
if ($maxWorkers -and $maxWorkers -as [int]) {
$currentWorkers = [int]$maxWorkers
$targetWorkers = $currentWorkers + (3 * $MirrorCount)
Set-ParamValue -paramName 'max_worker_processes' -value $targetWorkers.ToString() -requiresRestart $true
azure.yaml Outdated

# Stage 5: Purview Collection Creation
- run: ./scripts/automationScripts/FabricPurviewAutomation/create_purview_collection.ps1
- run: "$env:SKIP_PURVIEW_INTEGRATION='true'; ./scripts/automationScripts/FabricPurviewAutomation/create_purview_collection.ps1"
azure.yaml Outdated

# Stage 6: Register Fabric as Purview Data Source
- run: ./scripts/automationScripts/FabricWorkspace/CreateWorkspace/register_fabric_datasource.ps1
- run: "$env:SKIP_PURVIEW_INTEGRATION='true'; ./scripts/automationScripts/FabricWorkspace/CreateWorkspace/register_fabric_datasource.ps1"
azure.yaml Outdated

# Stage 17: Trigger Purview Scan (if Purview enabled)
- run: ./scripts/automationScripts/FabricPurviewAutomation/trigger_purview_scan_for_fabric_workspace.ps1
- run: "$env:SKIP_PURVIEW_INTEGRATION='true'; ./scripts/automationScripts/FabricPurviewAutomation/trigger_purview_scan_for_fabric_workspace.ps1"
CHANGELOG.md Outdated
Comment on lines +16 to +18
### Fixed
- Power BI headers initialization in Log Analytics linkage script to resolve workspace ID lookups

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants