Skip to content

feat: Add bring-your-own Log Analytics Workspace for Foundry app and wrapper resources#153

Open
Saswato-Microsoft wants to merge 11 commits into
microsoft:devfrom
Saswato-Microsoft:psl-loganalytics-fix
Open

feat: Add bring-your-own Log Analytics Workspace for Foundry app and wrapper resources#153
Saswato-Microsoft wants to merge 11 commits into
microsoft:devfrom
Saswato-Microsoft:psl-loganalytics-fix

Conversation

@Saswato-Microsoft
Copy link
Copy Markdown
Contributor

Purpose

This pull request introduces support for "Bring Your Own" (BYO) Log Analytics Workspace for observability of the deployed Foundry application and wrapper-managed resources (PostgreSQL Flexible Server, Fabric capacity). It allows users to supply an existing Log Analytics workspace, to which diagnostic logs and metrics from these resources will be routed. The documentation and infrastructure templates have been updated to reflect these changes, including new parameters, outputs, and guidance.

BYO Log Analytics Workspace (Observability) Support:

  • Added a new parameter existingLogAnalyticsWorkspaceResourceId in infra/main.bicep, infra/main.json, and infra/main.bicepparam to allow specifying an existing Log Analytics workspace for observability. [1] [2] [3]
  • When a workspace is provided, the deployment creates an Application Insights component linked to the workspace and configures diagnostic settings for PostgreSQL Flexible Server and Fabric capacity to send logs/metrics to it. [1] [2] [3] [4] [5] [6]
  • New outputs expose the resource IDs, connection strings, and instrumentation keys for the created Application Insights component, making them available for post-deployment automation or application configuration.

Documentation Updates:

  • Updated the deployment and parameter guides (README.md, docs/deploymentguide.md, docs/parameter_guide.md) to document the new BYO Log Analytics Workspace feature, including usage instructions, permissions required, and output references. [1] [2] [3] [4] [5] [6]
  • Added Bicep CLI as a required prerequisite in documentation to reflect its necessity for compiling infrastructure templates. [1] [2] [3]

Infrastructure Template Updates:

  • Updated the Bicep and generated ARM templates (infra/main.bicep, infra/main.json) to support the new observability parameter and logic, including conditional resource creation and diagnostic settings. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]
  • Updated Bicep/ARM template generator version to ensure compatibility with new features. [1] [2]

Does this introduce a breaking change?

  • Yes
  • No

Golden Path Validation

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

Deployment Validation

  • 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

  • ...

Other Information

Roopan-Microsoft and others added 8 commits April 29, 2026 11:07
Adds Bicep CLI (v0.33.0+) to the local deployment prerequisites so users provisioning this accelerator locally have the required Bicep version installed before running 'azd up' / 'az deployment'.

Work item: AB#42634
docs: Add Bicep CLI (v0.33.0+) to local deployment prerequisites
Copy link
Copy Markdown
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 adds “Bring Your Own” (BYO) Log Analytics Workspace support so the deployment can route diagnostics for wrapper-managed resources (PostgreSQL Flexible Server, Fabric capacity) to an existing workspace, and (optionally) create a workspace-based Application Insights instance linked to it. It also updates documentation to explain the new parameter, expected behavior, and prerequisites.

Changes:

  • Added existingLogAnalyticsWorkspaceResourceId parameter and conditional logic to enable BYO observability wiring.
  • Added diagnostic settings routing for PostgreSQL and Fabric capacity to the provided workspace, plus new outputs for the BYO App Insights instance.
  • Updated README and deployment/parameter guides to document the feature and add Bicep CLI as a prerequisite.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
README.md Documents Bicep CLI prerequisite in the main README.
infra/main.json Adds new BYO workspace parameter, conditional App Insights, diagnostic settings wiring, and related outputs; updates Bicep generator metadata.
infra/main.bicepparam Adds env-driven parameter for supplying an existing Log Analytics workspace resource ID.
infra/main.bicep Implements BYO workspace enablement, optional workspace-based App Insights creation, diagnostic settings wiring, and outputs.
docs/parameter_guide.md Adds a new section describing BYO Log Analytics Workspace behavior, configuration, outputs, and permissions.
docs/deploymentguide.md Updates prerequisites and documents how to configure BYO workspace via azd env var.

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

Comment thread infra/main.bicep Outdated
Comment thread infra/main.bicep
Comment thread infra/main.bicepparam Outdated
…urceId

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 12, 2026 05:40
Copy link
Copy Markdown
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 6 out of 6 changed files in this pull request and generated 5 comments.

Comment thread README.md
Comment thread README.md
Comment thread docs/deploymentguide.md
Comment thread docs/deploymentguide.md Outdated
Comment thread infra/main.bicep
Copilot AI review requested due to automatic review settings May 12, 2026 19:04
Copy link
Copy Markdown
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 6 out of 6 changed files in this pull request and generated 5 comments.

Comment thread infra/main.bicep
Comment on lines +114 to +116
@description('Optional. Full ARM resource ID of an existing Log Analytics workspace to use for observability of the deployed Foundry application and wrapper-managed resources (PostgreSQL, Fabric capacity). When provided, an Application Insights component is created in the deployment resource group and linked to this workspace, and diagnostic settings on the wrapper-managed resources are routed to it. Leave empty to skip BYO behavior. Format: /subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.OperationalInsights/workspaces/{name}.')
param existingLogAnalyticsWorkspaceResourceId string = ''

Comment thread infra/main.bicepparam
Comment on lines +27 to +32
// application and wrapper-managed resources (PostgreSQL, Fabric capacity).
// When provided, diagnostic settings on the wrapper-managed resources are
// routed to this workspace. An Application Insights component is also
// created in this RG and linked to the workspace, but only when
// deployAppInsights is true and deployLogAnalytics is false (the wrapper
// defaults). Leave empty to skip BYO behavior.
Comment thread docs/parameter_guide.md
Comment on lines +87 to +98
By default the wrapper sets `deployLogAnalytics = false`, so the AI Landing Zone does not create a new Log Analytics workspace and Application Insights is not provisioned. If you already have a centralized Log Analytics workspace (for example one shared across the platform), you can wire the deployed Foundry application and the wrapper-managed resources (PostgreSQL Flexible Server, Fabric capacity) to it.

### How it works

When you set `existingLogAnalyticsWorkspaceResourceId`:

1. An **Application Insights** component is created in the deployment resource group and linked to your existing workspace via `WorkspaceResourceId`. Its name follows the same `appInsightsName` convention (`appi-<resourceToken>`).
2. **PostgreSQL Flexible Server** diagnostic settings (all logs + AllMetrics) are routed to your workspace.
3. **Fabric capacity** diagnostic settings (all logs + AllMetrics) are routed to your workspace.
4. The connection string and instrumentation key are exposed as deployment outputs so post-provision automation (or your application configuration) can pick them up.

> **Note:** This is wrapper-side wiring. The upstream AI Landing Zone submodule does not natively support a BYO Log Analytics workspace, so leave `deployLogAnalytics = false` and `deployAppInsights = true` (the defaults) when using BYO so the LAZ does not create its own workspace + Application Insights pair.
Comment thread docs/deploymentguide.md
| `postgreSqlNetworkIsolation` | PostgreSQL private networking toggle (defaults to `networkIsolation`) | `networkIsolation` |
| `useExistingVNet` | Reuse an existing VNet | `false` |
| `existingVnetResourceId` | Existing VNet resource ID (when `useExistingVNet=true`) | `` |
| `existingLogAnalyticsWorkspaceResourceId` | Existing Log Analytics workspace to receive Foundry app + PostgreSQL + Fabric capacity diagnostics. May live in another subscription within the same tenant. | `` |
Comment thread docs/deploymentguide.md
Comment on lines +281 to +285
1. Create an Application Insights component in the deployment resource group, linked to your existing workspace.
2. Route PostgreSQL diagnostic logs and metrics to your workspace.
3. Route Fabric capacity diagnostic logs and metrics to your workspace.

The workspace may live in a different resource group or subscription within the same tenant. The identity running `azd up` needs **`Microsoft.Insights/diagnosticSettings/write`** on the workspace itself (covered by the built-in **Log Analytics Contributor** role scoped to the workspace or its resource group — subscription-wide rights are not required). See the **Observability — Bring Your Own Log Analytics Workspace** section in the [Parameter Guide](./parameter_guide.md) for the full output reference (App Insights resource ID, connection string, instrumentation key) and notes on deployment-history exposure of those values.
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.

6 participants