Skip to content

Add Azure Monitor Health Model as Bicep module#3064

Open
abossard wants to merge 17 commits into
Azure-Samples:mainfrom
abossard:feature/health-model-bicep
Open

Add Azure Monitor Health Model as Bicep module#3064
abossard wants to merge 17 commits into
Azure-Samples:mainfrom
abossard:feature/health-model-bicep

Conversation

@abossard

@abossard abossard commented May 22, 2026

Copy link
Copy Markdown

What this does

Adds a health model (Microsoft.CloudHealth/healthModels) that deploys alongside the existing infrastructure. It gives you a single-pane view of application health in the Azure portal, organized by use case.

image

It will help you to quickly figure out if things are not working.

Entity hierarchy

hm-{name} (root)
├── RAG Chat
│   ├── Backend Compute (CPU%, memory%, restarts, requests)
│   ├── App Performance (HTTP errors, exceptions, response time, dependency failures/duration)
│   ├── AI Inference (availability, latency, throttle, tokens in/out, client errors, rate limit, content blocks)
│   └── Knowledge Search (latency, QPS, throttle, docs processed, index size)
├── Document Ingestion
│   ├── Document Storage (transactions, latency)
│   └── Document Intelligence (success rate, latency, errors, pages processed)
├── Platform (if Container Apps)
│   └── Container Platform (ingress CPU)
└── Observability (if App Insights)
    └── Telemetry Pipeline (trace volume)

How it works

  • Conditional entities: only creates entities for resources that are actually deployed. Controlled by the same feature flags the rest of the infra uses (deployAzureOpenAi, useApplicationInsights, useSpeechOutputAzure, etc.).
  • Dedicated managed identity: creates its own user-assigned identity with Monitoring Reader + Reader roles. Does not reuse the search service identity.
  • 31 signal definitions: every signal uses metrics confirmed to emit data. No availabilityResults (requires configured tests), no EnvCoresQuotaUtilization (doesn't emit on Consumption plan).
  • Canvas layout: positions computed with Bicep arithmetic — each group's X offset accounts for its children, so adding entities doesn't cause overlaps.
  • Gated on useHealthModel param (default: false). Set AZURE_USE_HEALTH_MODEL=true to enable.

Notes

  • Uses Microsoft.CloudHealth/healthModels@2026-01-01-preview (preview API)
  • ARM deployments are additive — removing a signal definition from Bicep doesn't delete it from Azure. Requires manual cleanup or full teardown+recreate.
  • The azd provision command has a pre-existing template validation issue (duplicate resource group names) unrelated to this change. Direct az deployment group create works.

@abossard
abossard force-pushed the feature/health-model-bicep branch from bfd252f to 9900d35 Compare May 22, 2026 05:52
Adds a health model (Microsoft.CloudHealth/healthModels) that deploys
alongside the existing infrastructure via azd. The module:

- Creates a dedicated managed identity with Monitoring Reader + Reader roles
- Organizes entities by use case: RAG Chat, Document Ingestion, Platform, Observability
- Conditionally creates entities based on deployment flags (deploymentTarget,
  deployAzureOpenAi, useApplicationInsights, useSpeechOutputAzure, etc.)
- Includes 31 signal definitions covering:
  - OpenAI: availability, latency, throttle, tokens (input/output split),
    client errors (context-too-long), rate limiting, content policy blocks
  - App Performance: failed requests, exceptions, response time,
    dependency failures, dependency duration
  - Search: latency, QPS, throttle, documents processed, index storage
  - Container Apps: CPU%, memory%, restarts, request volume
  - Storage: transactions, latency
  - Document Intelligence: success rate, latency, errors, pages processed
  - Platform: ACA ingress CPU
  - Observability: telemetry trace volume
- Computes canvas layout positions with Bicep arithmetic (no overlaps)
- All resource IDs parameterized, no hardcoded subscriptions or names

Files changed:
  infra/core/monitor/health-model.bicep  (new)
  infra/main.bicep                       (module call + useHealthModel param)
  infra/main.parameters.json             (AZURE_USE_HEALTH_MODEL env var)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@abossard
abossard force-pushed the feature/health-model-bicep branch from 9900d35 to 3e6493f Compare May 22, 2026 05:55
…del Bicep module

Signed-off-by: Andre Bossard <anbossar@microsoft.com>
@abossard
abossard marked this pull request as ready for review May 22, 2026 18:24
@pamelafox

Copy link
Copy Markdown
Collaborator

@abossard Is there an AVM module for it? We prefer AVM modules now when possible, to avoid adding infra bloat to this repo itself. And are there restrictions for region, Azure account type (free trial), etc?

@abossard

abossard commented May 27, 2026

Copy link
Copy Markdown
Author

There's no AVM module, but that's good info. It currently is in public preview and in limited regions. I'll check what account types are supported. Thanks!

@pamelafox

Copy link
Copy Markdown
Collaborator

Then it needs to be default-off in main.parameters.json, otherwise it would break most deploys, no?
It also needs to be documented on the deploy_features markdown file.

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

Check Country Locale in URLs

We have automatically detected added country locale to URLs in your files.
Review and remove country-specific locale from URLs to resolve this issue.

Check the file paths and associated URLs inside them.
For more details, check our Contributing Guide.

File Full Path Issues
docs/deploy_features.md
#LinkLine Number
1https://learn.microsoft.com/en-us/azure/azure-monitor/health-models/overview417

@github-actions

Copy link
Copy Markdown

Check Country Locale in URLs

We have automatically detected added country locale to URLs in your files.
Review and remove country-specific locale from URLs to resolve this issue.

Check the file paths and associated URLs inside them.
For more details, check our Contributing Guide.

File Full Path Issues
docs/deploy_features.md
#LinkLine Number
1https://learn.microsoft.com/en-us/azure/azure-monitor/health-models/overview369

abossard added 3 commits June 17, 2026 20:55
Signed-off-by: Andre Bossard <anbossar@microsoft.com>
Signed-off-by: Andre Bossard <anbossar@microsoft.com>
@abossard

Copy link
Copy Markdown
Author

Hi @pamelafox

  • we don't have an AVM yet and also not in the works
  • it works on any azure accounts in general
  • the locations are being continuously expanded on, these are the current regions:
    UK South
    Canada Central
    Central US
    Sweden Central
    Southeast Asia
    Switzerland North
    Italy North
    North Europe

@pamelafox

Copy link
Copy Markdown
Collaborator

I have tested on my deployment:

Screenshot 2026-07-09 at 1 59 13 PM

@pamelafox

Copy link
Copy Markdown
Collaborator

I merged a fix for this issue in #3147

"The azd provision command has a pre-existing template validation issue (duplicate resource group names) unrelated to this change. Direct az deployment group create works."

Remove trailing whitespace (MD009) and add single trailing newline (MD047).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pamelafox

Copy link
Copy Markdown
Collaborator

I was able to simulate unhealthiness by running a load test. Here are more screenshots:

Screenshot 2026-07-09 at 2 46 57 PM Screenshot 2026-07-09 at 2 48 08 PM Screenshot 2026-07-09 at 2 47 58 PM Screenshot 2026-07-09 at 2 47 49 PM Screenshot 2026-07-09 at 2 47 37 PM

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds an Azure Monitor Health Model (Microsoft.CloudHealth/healthModels) to the infra deployment as a Bicep module, wiring it into the main template behind a feature flag and documenting how to enable/configure it via azd environment variables.

Changes:

  • Introduces infra/core/monitor/health-model.bicep defining the health model, managed identity, role assignments, signal definitions, entities, and relationships.
  • Wires the module into infra/main.bicep behind useHealthModel and adds parameters/env-var mappings for enablement and location.
  • Updates deployment docs and CI pipelines to pass through AZURE_USE_HEALTH_MODEL and AZURE_HEALTH_MODEL_LOCATION.
Show a summary per file
File Description
infra/main.parameters.json Adds useHealthModel and healthModelLocation parameter mappings to azd env vars.
infra/main.bicep Adds health model parameters and deploys the new health model module conditionally.
infra/core/monitor/health-model.bicep New module implementing the Azure Monitor Health Model resource hierarchy, signals, and identity/roles.
docs/deploy_features.md Documents how to enable Health Models and how to pick a supported region.
.github/workflows/azure-dev.yml Passes health model env vars through GitHub Actions workflow.
.azdo/pipelines/azure-dev.yml Passes health model env vars through Azure DevOps pipeline.

Review details

  • Files reviewed: 6/7 changed files
  • Comments generated: 2
  • Review effort level: Low

Comment thread infra/core/monitor/health-model.bicep
Comment thread infra/main.bicep
The App Service backend entity variant (entityBackendComputeAppSvc) was
missing canvasPosition, causing it to render at a default/overlapping
location on App Service deploys. Use the same computed position as the
Container Apps variant so the canvas layout is consistent.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pamelafox
pamelafox requested a review from Copilot July 9, 2026 22:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review details

  • Files reviewed: 6/7 changed files
  • Comments generated: 2
  • Review effort level: Low

Comment thread infra/core/monitor/health-model.bicep Outdated
Comment thread infra/core/monitor/health-model.bicep Outdated
Shift entityAiInference X offset to slot 2+(useApplicationInsights?1:0)
so it no longer overlaps the first Document Ingestion leaf when App
Insights is not deployed. Also fix 'role are assigned' -> 'roles are
assigned' and comment indentation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review details

  • Files reviewed: 6/7 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment thread infra/core/monitor/health-model.bicep
Comment thread docs/deploy_features.md Outdated
Comment thread docs/deploy_features.md
pamelafox and others added 2 commits July 9, 2026 15:21
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

3 participants